t.coursey Posted August 27, 2018 Share Posted August 27, 2018 Without adding any players/cameras or things, I have a world that starts at 0,0 and has general movement with ASWD keys. I would like to have whatever is getting spawned at 0,0 start at a different location, so they will be inside my structure/facility rather than just outside. I know I could move my objects, but they come in relative to other things I've created in my Modeling software. So I'd prefer to start the camera/player at a new spot. I don't see anything in the general code so far. I searched the documentation a bit, but probably was not searching for the correct thing. Any guidance? Link to comment
fox Posted August 28, 2018 Share Posted August 28, 2018 Hi Trey, Have You tried using setWorldPosition() for your player giving coordinates of your desired spawn point? Players are inherited from the Node class. This should do the trick! Hope this helps! Thank you! Link to comment
t.coursey Posted August 28, 2018 Author Share Posted August 28, 2018 6 hours ago, fox said: Hi Trey, Have You tried using setWorldPosition() for your player giving coordinates of your desired spawn point? Players are inherited from the Node class. This should do the trick! Hope this helps! Thank you! Thanks, I'm sure that will help. I'm a bit confused though. What node do I even ask Unigine to set, as I don't have a Player in my scene. But there is somehow a default player that has movement controls on it when I RUN the world. I'm guessing it's using the SceneCamera as a player maybe? Is there more you could elaborate on? Thanks for the guidance. Link to comment
morbid Posted August 29, 2018 Share Posted August 29, 2018 Hi, we have the Scene Camera (the one you control in Editor) and Game Camera that is used by default in your project. If you want to move this default camera just change coordinates in world script. See player.setPosition and player.setDirection values. The more comfortable camera control could be achieved by placing a custom player instead of the default one. I suggest checking world script in "procedural buildings generation demo". It's simple and easy to re-use. Fox meant that with setWorldPosition() you can easily change the coordinates of any node. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
t.coursey Posted August 29, 2018 Author Share Posted August 29, 2018 4 hours ago, morbid said: Hi, we have the Scene Camera (the one you control in Editor) and Game Camera that is used by default in your project. If you want to move this default camera just change coordinates in world script. See player.setPosition and player.setDirection values. The more comfortable camera control could be achieved by placing a custom player instead of the default one. I suggest checking world script in "procedural buildings generation demo". It's simple and easy to re-use. Fox meant that with setWorldPosition() you can easily change the coordinates of any node. Thanks! Thanks for the clarification @morbid Sorry for the noob questions! Link to comment
Recommended Posts