Game Development Community

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.

#1
11/01/2007 (7:58 pm)
You could definitely change the response mode when you are in the air / jumping versus when you are on the ground.

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).