Ambiera ForumDiscussions, Help and Support. |
|
[ 1 2 ] Page 1 of 2 |
|
|||||
|
Created a coppercube editor plugin to orbit (horizontally or vertically) the editor's perspective camera around a selected object using shift + "wasd" keys. For instructions and download, head on over to https://github.com/ssatguru/Copp... Give it a try and let me know of any issues. |
||||
|
Glad that someone else created this plugin too. I also had created a similar plugin some months ago but never released it to the public @samMhmdy was the only person with whom I shared the plugin. I mentioned the plugin in a post here but never got any response on that. https://www.ambiera.com/forum.ph... The only major drawback of having plugins for camera translation is that you will not be able to translate while holding down mouse keys which is why I never released it. I recently had a talk with @niko about this as well and maybe in the upcoming version, we will have support for a better keyboard and mouse Input in the plugin scripting API. I didn't try your version yet, but I think yours will have this issue with mouse keys too. Will give it a try :) I am really happy that you have created the same thing, I am still waiting for @niko to develop key inputs for editor API, I had many other ideas to accomplish to make the editor better. Also thanks a lot for making it available on github with great instructions. I hope the community will get benefit from it. :) |
||||
|
Just tried your version and yeah, it had the same mouse input issue, can't use it when holding down mouse keys. Also, you can enhance it a bit better by polishing the code a bit. For example, you can completely avoid the function that you have created for finding the camera. There is no need for a FOR loop to search the editor camera. You can simply use ccbGetSceneNodeFromName("Perspective") when in "Perspective mode" and "Top" when in "Top view Mode" and so on for other view modes as well. Also, you can avoid the camera translation when there is no node selected or the root node is selected otherwise it will open the scripting window as well. which can be annoying sometimes. other than that the camera works great, you should use an if condition to check the camera name, and make it work for other camera types too. like top mode, bottom, from, left, and right too. Hope my feedback will be helpful :) |
||||
|
@just Thanks for checking this out and the helpful feedback 1) Not sure I understand the mouse use case. When I am orbiting the camera around a selection I do not want to use mouse and/or rotate the camera at the same time too. I suspect you meant "translating" the camera using WASD rather than "orbiting" the camera which is what my plugin does. I can see why you would want to use the mouse when "translating". I also agree with the post and the poster you linked too. It would be nice if we can use "WASD" for "translation" instead of the arrow keys which is what we have today. arrows keys are ok for somebody who is left handed but definitely cumbersome for right handed people. Hard to use mouse and arrow keys at the same time when both of them are on the right side. 2) The reason I used a "FOR" loop to do a look up was to do an additional check. I check both the type ("camera") and the name. Just an additional check to make sure there is no other entity named "Perspective". 3) You are right about the node selection. Unfortunately there is a bug in the "editorGetSelectedSceneNode()" function. If a node is not selected then it is supposed to return 0 , as per this documentation https://www.ambiera.com/coppercu...
but it does not. So its hard to check for this condition. I will be reporting this in the bug section 4) You are right about making it more general for other camera types too. I will make it easy for people to change the camera name. 5) I corrected the document to show its shift+"wasd" keys rather than just "wasd" keys for orbiting. People can of course change the script to make it just "wasd" though that might interfere when they want to actually type in those characters in say some text field. |
||||
|
Yeah, mine was about camera translation but I was about to add orbiting and other camera features as well, I want it to orbit but with the mouse keys and I realised that mouse input was not supported in plugins and for translation as well the mouse keys were causing issues. 2.) You can still skip the For loop, by simply checking it like. var currentCam = ccbGetSceneNodeFromName("Perspective"); and can then use an if condition to check the "ID" if it is "-1" then do your calculation. By default, every editor nodes use a "-1" as an ID number. You can also get a scene node with an ID number using the undocumented Command. ccbGetSceneNodeFromId("ID"); it will return the node with that id. Nobody, literally nobody messes with the ID values in CopperCube so you don't have to worry about that. but yeah as long as the plugin is working with For Loop you can go with that too. I was just letting you know that you can do it in that way also. 3.) You can made an exception in your code, to only execute the script if the editorGetSelectedSceneNode();is true then only execute the script otherwise do nothing. In your plugins you are checking the position of the selected scenenode, while you can check it with the selected scenenode itself instead of the positon (snp). There is no bug in that. It works as expected. no need to report it. 0 = false, so if it returns false which is condition is not true then do nothing. 5) shift + WASD, will also do the same when people type in the text field, I use Shift most of the time when I have to write Uppercase letters. |
||||
|
1) yes it would be nice if we can capture mouse events in the editor too. 2) good to know about ID being -1 for editor nodes and the undocumented function ccbGetSceneNodeFromId("ID") You are right (id== -1) is a good check. Unfortunately if there are multiple nodes with the same name "ccbGetSceneNodeFromName()" just returns the first one. How would you check for the next one if the first one isn't right? 3) I did not have any luck with editorGetSelectedSceneNode(); It is not returning false/0 when no node is selected. Try the following sample code given in the documentation and let me know if it works for you
I am using 6.5.1 Also I would still like to orbit around camera's target in case no node is selected. 4) shift+wasd or alt-wasd or ctl-wasd might be better choice then just wasd given that we might have an issue with the editor. The editor should not be bubbling up the key event if the user is typing in a text field. |
||||
|
very nice feature for CC! |
||||
|
Thanks ssatguru for the plugin! |
||||
|
@ssatguru the code from the sample documentation
works completely fine for me, it does return false for me. below is the screenshot that shows the result of the code. |
||||
|
@just if it was returning "false" you should have seen the message 'nothing selected' and not 'Name of the selected node is "false"'. Also the output window should not open with the message "Could not get property, provided scene node is invalid." |
||||
|
Yes, you are right, the code didn't work, I was like it is supposed to alert with false, didn't notice it has to print "nothing selected", Definitely needs to be reported. Meanwhile you can try something like this. var s = editorGetSelectedSceneNode(); it will work, but might still open the popup of scripting window. |
||||
|
I must have missed this post completely as quite a good addition actually by 'ssatguru' and 'just_in_case'. I couldn't see 'just_in_case' plugin so adjusted the 'ssatguru' one with dynamic movement speed changes with keyboard controls (+ and -) This is a lot easier to use CopperCube now....with fast change to speed up and slow down....a very useable plugin. https://robo25.itch.io/coppercube-camera-movement |
||||
|
Thanks for the update @robo, yeah, I never released that plugin to the public, only shared it with @smnMhmdy on Discord. As there was nothing fancy in there but a camera controller with movement by using WASD, and I never found it to be useful as it stops working when mouse keys are pressed so never released it, and didn't work over it anymore. I prefer to have mouse controls in plugins as well, as plugins are part of the editor source we can't develop or extend them to have custom controls just like other API commands extensions. |
||||
|
Plugin updated as using WASD wont allow you enter the text of WASD anymore... Now setup to use CTRL + standard arrow keys (better IMO) |
||||
|
Very, very helpful, BIG THANKS @Robbo! Your modded version seems to solve a longer ago discussed issue regarding more effective editor viewport navigation: (Thread: "uneffective mouse navigation at large scale worlds") https://ambiera.com/forum.php?t=... |
[ 1 2 ] Page 1 of 2 |
|