Problems with custom collision
by Viktor Rumanuk · in Torque X 2D · 04/06/2008 (5:47 pm) · 6 replies
I'm having trouble getting a custom collision to work. I have the method set up but I'm running into trouble exposing it to TXB. Could someone maybe show me a code sample of a working custom collision?
Thanks a lot, Viktor
Thanks a lot, Viktor
#2
04/08/2008 (7:06 pm)
I'm just trying to create a custom collision method and delegate that can be set in the objects collision component. As in the "Exposing Properties to TXB" portion of the user's guide. I will have a look at the demo, thanks.
#3
How are you defining the custom collision function?
I'm starting to think there is a bug with exposing delegates that got introduced in 2.0. It was simple in 1.0 but I can't get it to work in 2.0.
04/08/2008 (8:50 pm)
Since you say TXB I"m assuming you are talking about a 2d project.How are you defining the custom collision function?
I'm starting to think there is a bug with exposing delegates that got introduced in 2.0. It was simple in 1.0 but I can't get it to work in 2.0.
#4
04/09/2008 (3:41 pm)
Yeah its 2D, should've clarified earlier. Here is the example function from the user's guide: public static void SpinCausingCollision(T2DSceneObject us, T2DSceneObject them, T2DCollisionInfo info, T2DResolveCollisionDelegate resolve, T2DCollisionMaterial physicsMaterial)
{
us.Physics.AngularVelocity += 10.0f;
them.Physics.AngularVelocity -= 10.0f;
} I just changed the name and code inside the function. I'm a little bit confused about the other things that I need to do, I feel like I'm almost there though. That's why this is bothering me so much, it seems simple but I keep running into problems. Hopefully if there is a bug we can expose it here.
#5
04/09/2008 (3:51 pm)
Ok I just verified it. You aren't doing anything wrong. Using the exact same code from my previous TX 1 game I couldn't get TXB to see it. It's a bug with TX or TxB.
#6
04/09/2008 (4:14 pm)
Ok then, thanks for the help. I guess I'll just focus on something else for a while.
Torque Owner Russell Bishop
Default Studio Name
If you look at the FPS demo game you should see a FPSPlayerControlComponent and various states in player/ControlComponent.cs. Also look at the classes these derive from, such as T3DGroundControlComponent. They should give you an example of how to cast rays, etc.
The demo game is in the install folder in program files, garage games, etc.