Having different collision responses depending on the objects?
by Manjit Bedi · in Torque Game Builder · 11/01/2007 (5:40 pm) · 1 replies
Hello all.
I am not certain how to get the best results here. Let me explain.
I have the main game character collison response mode set to clamp. When he walks along the playfield there are colliosn with the floor. When he bumps into other characters using clamp usually works fine.
But sometimes if the characer is airborne as jumps down from a platform to floor, he can bump into a NPC and shoot off flying upwards.
It seems to be related to the angle of the line segment on the NPC where the player makes contact.
I did try setting things to "sticky" but then the player character moves very slowly along the floor. Is there a way to have a specific collision response depending on the object being collided with.
It sems to be I would need to handle the collision response differently depending on the object collided with and taking the normal into account possibly. I am looking for the 'elegant' solution if there is one.
Many thanks.
M.
I am not certain how to get the best results here. Let me explain.
I have the main game character collison response mode set to clamp. When he walks along the playfield there are colliosn with the floor. When he bumps into other characters using clamp usually works fine.
But sometimes if the characer is airborne as jumps down from a platform to floor, he can bump into a NPC and shoot off flying upwards.
It seems to be related to the angle of the line segment on the NPC where the player makes contact.
I did try setting things to "sticky" but then the player character moves very slowly along the floor. Is there a way to have a specific collision response depending on the object being collided with.
It sems to be I would need to handle the collision response differently depending on the object collided with and taking the normal into account possibly. I am looking for the 'elegant' solution if there is one.
Many thanks.
M.
About the author
Been making mobile iOS apps mostly in UI Kit. Been doing a few game related projects more recently.
Associate James Ford
Sickhead Games
As for dynamically using a different collision response depending on the object you are colliding with... That sounds to me like a custom collision response, which would need to done on the C++ side of TGB. In scripting you can deal with collisions in oncollision but the collision response happens BEFORE that in C++, so, this is not a problem you can solve with script (or I can't think of a way).