Making decals stick?
by deepscratch · in Torque Game Engine Advanced · 12/20/2008 (9:48 am) · 6 replies
Hi all,
I've managed to get bullet decals to appear on ANYTHING that I shoot at, diffs, terrain, water, vehicles, characters, really anything.
problem is, when the subjects are "moveable", ie: vehicles, players, the decals don't move with them, just kind of hang in the air at the point of impact.
so how can I make the decals "stick" to these objects?
I did search the forums, but the answers are very vague.
any ideas??
I've managed to get bullet decals to appear on ANYTHING that I shoot at, diffs, terrain, water, vehicles, characters, really anything.
problem is, when the subjects are "moveable", ie: vehicles, players, the decals don't move with them, just kind of hang in the air at the point of impact.
so how can I make the decals "stick" to these objects?
I did search the forums, but the answers are very vague.
any ideas??
About the author
email me at medan121@gmail.com
Recent Threads
#2
how did you do that?
"making the object hit, the owner of the decal, and when it moves it takes its decals with it"
12/20/2008 (10:05 am)
@stefan,how did you do that?
"making the object hit, the owner of the decal, and when it moves it takes its decals with it"
#3
12/20/2008 (10:55 am)
Quote:making the object hit, the owner of the decal, and when it moves it takes its decals with itYeah, do tell, please. That piqued my curiosity. I never thought of that - any pointers?
#4
Basically:
* When your projectile hits the object, it will call onCollision. When that happens, your decal is created and you can pass it on to the object and put it in a list of some kind. Do also store positional/rotational offset for the collider.
* In the objects advanceTime (), you can then make the decal follow the collider "around" by setting the same position as the collider, but adding your offsets which you saved earlier. This is actually very much like how the ShapeBase Image system works.
Whether this is performant or effective use of resources, is something I don't know yet as we haven't used this for very long. Time will tell. You should at least attempt to limit the amount of shapes which can do this, and the amount of decals that stay around.
12/20/2008 (11:32 am)
There's not much more to tell. It's quite simple, really.Basically:
* When your projectile hits the object, it will call onCollision. When that happens, your decal is created and you can pass it on to the object and put it in a list of some kind. Do also store positional/rotational offset for the collider.
* In the objects advanceTime (), you can then make the decal follow the collider "around" by setting the same position as the collider, but adding your offsets which you saved earlier. This is actually very much like how the ShapeBase Image system works.
Whether this is performant or effective use of resources, is something I don't know yet as we haven't used this for very long. Time will tell. You should at least attempt to limit the amount of shapes which can do this, and the amount of decals that stay around.
#5
12/20/2008 (1:05 pm)
Hey thanks. That actually makes sense, I just never thought of treating decals like they were (sort of) mounted objects. That's one thing I like about these forums -- you can learn a new way to take advantage of what's already there almost every day.
#6
sorry to ask, ("I have the code, write it" is not my stong point, I'm good at copy/paste though)
so please could someone help a little bit more?
12/20/2008 (1:13 pm)
I'm not much of a coder, so how would I go about doing that?sorry to ask, ("I have the code, write it" is not my stong point, I'm good at copy/paste though)
so please could someone help a little bit more?
Torque Owner Stefan Lundmark