noemen Posted March 31, 2020 Share Posted March 31, 2020 (edited) I'm doing some tests with RigidShape. I created a ball to be controlled instead of the Player. I managed to create a control, where the ball follows according to the keyboard (w, s, a and d) and placed an Orbit Camera on the object.So far so good, but the problem is that the object does not move in the direction where the camera is looking. Example:If the camera is looking at the X axis and pressing the W keyboard, I wanted the object (ball) to move to the X axis where the camera is looking. As well as if the object is stopped, the camera can rotate freely without moving the object (ball).A great example is the game Marble Blast, I want the ball to have the same mechanics as Marble (in relation to the camera, because the movement is already ok). Edited April 1, 2020 by noemen Quote Link to comment Share on other sites More sharing options...
Duion Posted March 31, 2020 Share Posted March 31, 2020 Why don't you just replace the character with a ball and adjust the physics of the player data? Or use a vehicle, since I can imagine the physics of a vehicle can match those of a ball more. Quote Link to comment Share on other sites More sharing options...
noemen Posted March 31, 2020 Author Share Posted March 31, 2020 Why don't you just replace the character with a ball and adjust the physics of the player data? Or use a vehicle, since I can imagine the physics of a vehicle can match those of a ball more. @Duion Thank you very much. I will do some tests.I was taking a look at the documentation and saw that it has getRotation (). I will see if I can capture the rotation of the camera and change the movement of the ball according to the camera. Quote Link to comment Share on other sites More sharing options...
Duion Posted March 31, 2020 Share Posted March 31, 2020 Why not make a vehicle consisting of only one wheel? Quote Link to comment Share on other sites More sharing options...
noemen Posted April 1, 2020 Author Share Posted April 1, 2020 I looked right here and decided to simplify everything ... Because the prototype was not pleasant. But I believe that the doubt of this topic can help other people. And whoever can answer, will be helping those who need help.As I decided not to go deeper, but I believe that this can be solved as follows:You would take the camera rotation with getRotation () and try to modify the control according to the camera.@Duion Thank you very much for helping me, I ended up having other ideas. Quote Link to comment Share on other sites More sharing options...
fLUnKnhaXYU Posted April 1, 2020 Share Posted April 1, 2020 with this little line you can hold freelook , move the camera , excute this line and it will apply impulse to the player in the direction of the camera view , I guess the program adds the player rotation to the camera . %player.applyimpulse(%player.getposition(),vectorscale(%player.geteyevector(),"10000 10000 10000")); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.