This topic is 2530 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, i'm currently using a 3d Engine, and i'm trying to make the character move where it's facing(Where the camera is facing basically) And, it's working out. But, the problem that i'm having is when I move the camera, the character changes speed. So, to solve this problem we need to dumb down the numbers, and when you would add them it will ALWAYS equal x. In our case, the x = 2.

5x 5z ->>> 1x+1z = 2
10x 10z ->>> 1x+1z = 2
15x 15z ->>> 1x+1z = 2
15x 30z ->>> x + z = 2

I think I need to take the ratio and somehow put it... I don't know myself, so that's why i'm asking you guys. Help is very much appriciated :3

EDIT: I figured it out, you need to find out the ratio of x and z summed up - compared to x. So if it's 15x to 30z the ratio will be 1:3(15 x 3 = 45). Then, you need to apply that ratio to 2(2 / 3 * 1), that will give you the x, and then you just 2 - x to get the z.and z takes the x value.

EDIT: Worked in my head, doesn't work when you put it in the code! :3 Because, x can become negative.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633769
• Total Posts
3013759
×