RigidShape - Walk in the direction the camera is looking

Scripting questions, discussions, etc
6 posts Page 1 of 1
noemen
Posts: 100
Joined: Tue May 29, 2018 3:46 pm
 
  by noemen » Tue Mar 31, 2020 9:35 am
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).
Last edited by noemen on Wed Apr 01, 2020 4:16 am, edited 2 times in total.
Duion
Posts: 1603
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Tue Mar 31, 2020 1:09 pm
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.
noemen
Posts: 100
Joined: Tue May 29, 2018 3:46 pm
 
by noemen » Tue Mar 31, 2020 10:43 pm
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.
Duion
Posts: 1603
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Tue Mar 31, 2020 11:07 pm
Why not make a vehicle consisting of only one wheel?
noemen
Posts: 100
Joined: Tue May 29, 2018 3:46 pm
 
by noemen » Wed Apr 01, 2020 4:28 am
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.

@
User avatar
Duion
Thank you very much for helping me, I ended up having other ideas.
fLUnKnhaXYU
Posts: 158
Joined: Wed Nov 15, 2017 8:19 am
by fLUnKnhaXYU » Thu Apr 02, 2020 1:04 am
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"));
6 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests