Alpha 1.1 -- Weird Movement Issues with Platformer Tutorial
by Glenn Prince · in Torque Game Builder · 11/29/2005 (2:36 am) · 7 replies
Hey guys,
I am working my way through the platformer tutorial (albiet changing some of the variable names and images etc) and I am coming across some weird action map issues. Bascily It seems if I jump and come down moving on a flat platform and keep moving for a little bit, the sprite won't seem to jump again. It's a little hard to explain but basicly it prevents the player from jumping. My code has been zipped up and attached using the following link:
http://members.optusnet.com.au/~gprince79/t2d/Sidescroller.zip
Password is t2duseronly. I am not really sure why it does it and any help would be appreciated !!
I am working my way through the platformer tutorial (albiet changing some of the variable names and images etc) and I am coming across some weird action map issues. Bascily It seems if I jump and come down moving on a flat platform and keep moving for a little bit, the sprite won't seem to jump again. It's a little hard to explain but basicly it prevents the player from jumping. My code has been zipped up and attached using the following link:
http://members.optusnet.com.au/~gprince79/t2d/Sidescroller.zip
Password is t2duseronly. I am not really sure why it does it and any help would be appreciated !!
About the author
#2
11/29/2005 (1:12 pm)
Cheers Melv.
#3
On another note (and you may already know this) but I noticed that in your example code, your datablock uses the field "inset" and that you're getting visual artifacts from both the player and the tiles. The "inset" field doesn't exist anymore and was used to remove the artifact I just mentioned. To remove the artifact, just replace it with the field "filterPad = true;" and all will be well. Definately have a read of the new T2D Image-Map PDF if you haven't already.
Again, thanks for reporting the issue.
- Melv.
11/30/2005 (1:23 am)
@Glenn: I'm getting the same problem here which is odd because I wrote a simple platformer and tested that it worked consistently. I guess something broke since then. I've created an issue for this on our system (#0000854). This is definately the worst problem with the alpha so far so I'll get this fixed ASAP, thanks for reporting it.On another note (and you may already know this) but I noticed that in your example code, your datablock uses the field "inset" and that you're getting visual artifacts from both the player and the tiles. The "inset" field doesn't exist anymore and was used to remove the artifact I just mentioned. To remove the artifact, just replace it with the field "filterPad = true;" and all will be well. Definately have a read of the new T2D Image-Map PDF if you haven't already.
Again, thanks for reporting the issue.
- Melv.
#4
The code I posted up was almost a straight copy off the TDN so I didn't bother fixing up little consistancies with the datablocks and other bits and pieces (eg the collision polygon is huge compared to the sprite etc).
Thanks for the response Melv (and the great product !!)
11/30/2005 (12:58 pm)
Thanks Melv, thought I was going mental :-PThe code I posted up was almost a straight copy off the TDN so I didn't bother fixing up little consistancies with the datablocks and other bits and pieces (eg the collision polygon is huge compared to the sprite etc).
Thanks for the response Melv (and the great product !!)
#5
I've found some strange problems that I'm working on now but in the meantime, here's a fix to get you around the specific problem you're having. Simply overwrite the "resolveClampCollision" in "t2dPhysics.cc" and rebuild. Be careful of the pain-in-the-ass line-wrapping that this web-site does here for codeblocks.
I'm not closing issue #0000854 as there are other related issues I need to solve but if you could please let me know if this solves your specific problem for now, that'd be great.
- Melv.
12/01/2005 (4:55 am)
Glenn,I've found some strange problems that I'm working on now but in the meantime, here's a fix to get you around the specific problem you're having. Simply overwrite the "resolveClampCollision" in "t2dPhysics.cc" and rebuild. Be careful of the pain-in-the-ass line-wrapping that this web-site does here for codeblocks.
void t2dPhysics::resolveClampCollision( bool solveSrc, bool solveDst, cCollisionStatus* pCollisionStatus, const U32 contactIndex )
{
// Solve Source?
if ( solveSrc )
{
const t2dVector preVel = pCollisionStatus->mpSrcPhysics->getGrossLinearVelocity();
// Fetch Linear Velocity / Collision Normal.
t2dVector linearVelocity = pCollisionStatus->mpSrcPhysics->getGrossLinearVelocity();
t2dVector collisionNormal = pCollisionStatus->mCollisionNormal;
// Normalise Collision Normal.
collisionNormal.normalise();
// Calculate Dot Velocity Normal.
const F32 dotVelocityNormal = collisionNormal * linearVelocity;
// Any velocity to clamp?
if ( dotVelocityNormal < 0.0f )
{
// Set new Linear Velocity.
// NOTE:- vO = vI - ((NvI)N)
pCollisionStatus->mpSrcPhysics->setGrossLinearVelocity( linearVelocity-(collisionNormal*dotVelocityNormal) );
}
}
// Solve Destination?
if ( solveDst )
{
// Fetch Linear Velocity / Collision Normal.
t2dVector linearVelocity = pCollisionStatus->mpDstPhysics->getGrossLinearVelocity();
t2dVector collisionNormal = pCollisionStatus->mCollisionNormal;
// Normalise Collision Normal.
collisionNormal.normalise();
// Calculate Dot Velocity Normal.
const F32 dotVelocityNormal = collisionNormal * linearVelocity;
// Any velocity to clamp?
if ( dotVelocityNormal < 0.0f )
{
// Set new Linear Velocity.
// NOTE:- vO = vI - ((NvI)N)
pCollisionStatus->mpDstPhysics->setGrossLinearVelocity( linearVelocity-(collisionNormal*dotVelocityNormal) );
}
}
}I'm not closing issue #0000854 as there are other related issues I need to solve but if you could please let me know if this solves your specific problem for now, that'd be great.
- Melv.
#6
12/01/2005 (3:31 pm)
Will try and complie it tonight (7 hours time).
#7
I'm following the "ninja" mini-tutorial on TDN... When I land (after a "jump") on a flat surface with right or left key pressed, my character will not jump again. I thought the problem was something on the code's logic, but it seems that it is this same bug.
PS: I'm using TGB 1.1.1 / T2D 1.1.2 and I don't have TGB's source code.
10/22/2006 (1:33 am)
I'm suffering with this same bug (almost one year after Glenn's report!!!)I'm following the "ninja" mini-tutorial on TDN... When I land (after a "jump") on a flat surface with right or left key pressed, my character will not jump again. I thought the problem was something on the code's logic, but it seems that it is this same bug.
PS: I'm using TGB 1.1.1 / T2D 1.1.2 and I don't have TGB's source code.
Associate Melv May
- Melv.