Conform player's bounding box to ground
by Ivan Mandzhukov · in Torque Game Engine Advanced · 01/24/2008 (5:59 am) · 5 replies
I'm trying to reduce the height between player and terrain when go up/down, the difference is very big.
In demo, GG hide it just using 3th person and do not render the legs, but in orbit style (like console game) it is quite a visible defect in physics, even integrating the Conform resource for rotating the box.
I tried to study the code, did a lot of corrections - still no success.
You can see that here:
img175.imageshack.us/my.php?image=errorin9.jpg
In demo, GG hide it just using 3th person and do not render the legs, but in orbit style (like console game) it is quite a visible defect in physics, even integrating the Conform resource for rotating the box.
I tried to study the code, did a lot of corrections - still no success.
You can see that here:
img175.imageshack.us/my.php?image=errorin9.jpg
#2
But that anly rotate correctly the box, i need to correct the mobjbox physics.
I am working on it since a week, i found that that physics is complicated and done in 4 classes.
I just want a advice where exactly i should touch the code and correct the transformations.
01/24/2008 (11:35 pm)
This resource is working in TGEA also, i already tried that corrections.But that anly rotate correctly the box, i need to correct the mobjbox physics.
I am working on it since a week, i found that that physics is complicated and done in 4 classes.
I just want a advice where exactly i should touch the code and correct the transformations.
#3
in fact position is affected in SceneObject, but correcting the whole class it should transform everything in the world.
so the decision is to create a render transform only for the player
in SetRenderTransform method i decided to get the 3th column of transformation matrix and reduced z component with 0.3 -> voala
now there is a new problem - when go up everything is correct
when go down , player sinks a bit in terrain
now i need a dot product (scalar), that controls the steep clone
this is a problem, because moveVec in my correction is not co-liear with XY plane, so it does not store a unit projection direction of movement. Eventually a dot product will return a zero scalar, because the angle of moveVec and contactNormal of terrain are perpendicular.
i will try to create a new vector,that stores the XY of moveVec
in fact cos(angle) returns a positive scalar in 1st/4th quadtant, so this is a problem too.
01/25/2008 (9:56 am)
I found a way:in fact position is affected in SceneObject, but correcting the whole class it should transform everything in the world.
so the decision is to create a render transform only for the player
in SetRenderTransform method i decided to get the 3th column of transformation matrix and reduced z component with 0.3 -> voala
now there is a new problem - when go up everything is correct
when go down , player sinks a bit in terrain
now i need a dot product (scalar), that controls the steep clone
this is a problem, because moveVec in my correction is not co-liear with XY plane, so it does not store a unit projection direction of movement. Eventually a dot product will return a zero scalar, because the angle of moveVec and contactNormal of terrain are perpendicular.
i will try to create a new vector,that stores the XY of moveVec
in fact cos(angle) returns a positive scalar in 1st/4th quadtant, so this is a problem too.
#4
01/28/2008 (7:23 pm)
One comment, you may add a foot mount point inside your model, and then check that this point is always in contact with the terrain. Then just do all your positionning according to this point.
#5
i can get rotation change using 'delta' - it is a present information in network
mFabs(delta.rotVec.x + delta.rotVec.y) appears to 'carry' the steep clone information
anyway, this is the little broblem
the real broblem is that the conform modification is unstable (engine can crash after 10-15 minutes in runtime , or player can fall through terrain).
first i should fix the resource to be stable, then do my corrections
01/29/2008 (5:56 am)
The better idea:i can get rotation change using 'delta' - it is a present information in network
mFabs(delta.rotVec.x + delta.rotVec.y) appears to 'carry' the steep clone information
anyway, this is the little broblem
the real broblem is that the conform modification is unstable (engine can crash after 10-15 minutes in runtime , or player can fall through terrain).
first i should fix the resource to be stable, then do my corrections
Associate David Montgomery-Blake
David MontgomeryBlake