Third person camera problem

Started by
25 comments, last by Evil Steve 12 years ago
i put D3DXVECTOR3 vCharPos(0.0f,0.0f,0.0f);
that is going to lock the positon always to that value so i dont think that will work

dt is the timer stuff
:)
Advertisement

i put D3DXVECTOR3 vCharPos(0.0f,0.0f,0.0f);
that is going to lock the positon always to that value so i dont think that will work

dt is the timer stuff
Well, your code changes the Z position based on 5.0*dt, so no - it won't lock it to that unless you want it to.

The point is that you cannot have any uninitialised variables anywhere in your code or all bets are off. All varaibles need to be initialised to known values; the exact value they're initialised to depends entirely on your code.

My point about dt was - what is the value of it? Is it 0? 9000.473? Because your fat clip plane is set to 100 units, so you need to make sure everything is within that distance.

[quote name='Anddos' timestamp='1332349802' post='4924007']
i put D3DXVECTOR3 vCharPos(0.0f,0.0f,0.0f);
that is going to lock the positon always to that value so i dont think that will work

dt is the timer stuff
Well, your code changes the Z position based on 5.0*dt, so no - it won't lock it to that unless you want it to.

The point is that you cannot have any uninitialised variables anywhere in your code or all bets are off. All varaibles need to be initialised to known values; the exact value they're initialised to depends entirely on your code.

My point about dt was - what is the value of it? Is it 0? 9000.473? Because your fat clip plane is set to 100 units, so you need to make sure everything is within that distance.
[/quote]


if i add D3DXVECTOR3 vCharPos(0.0f,0.0f,0.0f);
and look at the output positon then its locked to the same poistion and its obvious it would do that as its in the render loop

the dt value is ever changing, theres no set value
:)
So you now have:

D3DXVECTOR3 vCharPos(0.0f,0.0f,0.0f);
D3DXVECTOR3 vCharFacing(0.0f,0.0f,-1.0f); //facing down -z;
vCharPos.x = 0.0f; vCharPos.y; vCharPos.z -= 5.0f * dt;
Right? Then vCharPos.z is changing based on the value of dt, it shouldn't be locked to the same value.
it is because render is in a loop , everytime it loops its going to set z to 0.0f again
:)
You said that dt is changing every frame...

Assuming on frame 1, dt=0, frame 2, dt=1, frame 3, dt=2, etc:
Frame 1: vCharPos = (0, 0, 0)
Frame 2: vCharPos = (0, 0, -5)
Frame 3: vCharPos = (0, 0, -10)

yes but thats going to get reset on the next frame render if its going back to 0.0f isnt it?
:)
Only if you reset dt to 0 every frame.

Have you actually tried it?
yes i have tried, the positon stays the same
:)
Ok, then what does your debugger tell you? You can examine the vCharPos, vAt and vEye variables across a few frames and see how / why they change (or don't change).

This topic is closed to new replies.

Advertisement