Collision question: two objects "crossing"
by Ignis · in Game Design and Creative Issues · 06/10/2010 (12:48 pm) · 2 replies
Hello all,
I'm relatively new to TGB but over the past few weeks I have learned the basics of TorqueScript, the TGB editor, etc. I have accomplished a decent amount with basic trial and error, but I reached a stumbling block today. :)
My question is, how can I set up two objects to cross each other and trigger a scripted onCollision event, but not respond to any of the five "collision response" settings? I have set up the scripted trigger, which responds as expected, but the two objects still collide based on the collision response setting. However, I don't want them to bounce off each other or anything like that... I only want to trigger the scripted event, then each object continues on its merry way.
Here's a basic example of my intention (not what I'm actually doing in the game, but a simple comparative example):
On the screen is an object named "PaintPuddle". Another object, "Player", moves toward the puddle. When the two objects collide, I use script to read the paint puddle's color and then assign that color to "Player" (so in effect, the player turns the same color as the paint puddle). BUT, I obviously don't want these two objects to bounce/stick/kill upon collision... they simply overlap each other and the player can continue moving around, while the puddle stays motionless.
I'm sure there's a very easy solution to this, but it eludes me at the moment so I turn to the expertise of those who have been programming much longer than myself! Any and all help is much appreciated.
Brent
I'm relatively new to TGB but over the past few weeks I have learned the basics of TorqueScript, the TGB editor, etc. I have accomplished a decent amount with basic trial and error, but I reached a stumbling block today. :)
My question is, how can I set up two objects to cross each other and trigger a scripted onCollision event, but not respond to any of the five "collision response" settings? I have set up the scripted trigger, which responds as expected, but the two objects still collide based on the collision response setting. However, I don't want them to bounce off each other or anything like that... I only want to trigger the scripted event, then each object continues on its merry way.
Here's a basic example of my intention (not what I'm actually doing in the game, but a simple comparative example):
On the screen is an object named "PaintPuddle". Another object, "Player", moves toward the puddle. When the two objects collide, I use script to read the paint puddle's color and then assign that color to "Player" (so in effect, the player turns the same color as the paint puddle). BUT, I obviously don't want these two objects to bounce/stick/kill upon collision... they simply overlap each other and the player can continue moving around, while the puddle stays motionless.
I'm sure there's a very easy solution to this, but it eludes me at the moment so I turn to the expertise of those who have been programming much longer than myself! Any and all help is much appreciated.
Brent
About the author
Novice game programmer + artist, graphic/web designer, photographer.
#2
I see the Trigger object in the level editor, but I haven't learned how to use it yet... this might be exactly what I need. At first glance, I see some options like "Enter Callback", "Stay Callback", and "Leave Callback" which seems logical... as in, using these to determine when object "Player" in my example enters the area of "PaintPuddle", when it leaves that area, etc.
Brent
06/10/2010 (4:10 pm)
Thanks Daniel!I see the Trigger object in the level editor, but I haven't learned how to use it yet... this might be exactly what I need. At first glance, I see some options like "Enter Callback", "Stay Callback", and "Leave Callback" which seems logical... as in, using these to determine when object "Player" in my example enters the area of "PaintPuddle", when it leaves that area, etc.
Brent
Torque Owner Daniel Buckmaster
T3D Steering Committee