Search In
• More options...
Find results that contain...
Find results in...

Move ped relative to camera angle ?

Recommended Posts

Hello there !

I have the following issue, I want to move around a ped , for example If I press "P" I want to move the ped forward, into the direction I am looking right now.

Currently I am only able to move the Ped around on the X, Y, Z axis.

Does somebody has an idea of how to do the thing I want to do , basically I want to move the ped into a direction relative from the camera angle.....

Regards,

Graphicscore

Share on other sites

Get the camera's rotation, convert it to direction, then change the player's position with the direction (newPos = playerPos + camDirection) or apply force using the direction.

Share on other sites

Get the camera's rotation, convert it to direction, then change the player's position with the direction (newPos = playerPos + camDirection) or apply force using the direction.

If that works I love you.

May I ask what the 0.0174532924 stands for ?

Edited by Graphicscore
Share on other sites

Get the camera's rotation, convert it to direction, then change the player's position with the direction (newPos = playerPos + camDirection) or apply force using the direction.

If that works I love you.

May I ask what the 0.0174532924 stands for ?

Ha, GAAAAAAAAAAY.

lol jk

It is 1 degree in radians.

Nition said: ↑

That 0.0174532924f is one degree in radians. Still no idea why they they're rotating it an extra one degree at the end though.

--------

It's (Angle * 0.017...)

It's the quick way to convert degrees to radian.

360 degrees * 0.017 = 2 * Pi
Edited by LetsPlayOrDy
• 1

Create an account

Register a new account