- Joined
- Oct 29, 2007
- Messages
- 1,184
I am trying making a jump system that changes a units flying height in a lifelike way, without interference from the grounds z value. The jump increases the unit z with velocity v. Then gravity pulls the unit down with accelleration a=g. The problem occurs where the the terrain height from the start to the end of the jump changes. (The unit may be changing x and y while jumping.)
I think the formula for height h should be like this for each change in time t: h(t) = hunit flying height current + hchange in terrain from origin to end of jump + hvelocity v - hgravitity g
This, however, creates some very strange changes in the units z value where sometimes the unit u would jump 10 x its own height into the air, and other times it would hardly jump at all, given the grounds z changes from origin to end. Where the grounds z doesn't change, the formula seems to be correct.
Can someone help me adjust this formula correctly? I think I might not have the change in terrain z thing right.
I think the formula for height h should be like this for each change in time t: h(t) = hunit flying height current + hchange in terrain from origin to end of jump + hvelocity v - hgravitity g
This, however, creates some very strange changes in the units z value where sometimes the unit u would jump 10 x its own height into the air, and other times it would hardly jump at all, given the grounds z changes from origin to end. Where the grounds z doesn't change, the formula seems to be correct.
Can someone help me adjust this formula correctly? I think I might not have the change in terrain z thing right.