Projectiles that go through walls but not players
by Tom · in Torque Game Engine · 08/29/2006 (7:53 am) · 4 replies
As the title says, im looking for a projectile that will go through walls, but not players.
its for an ultimate weapon in my game, and i was wondering if anyone has gotten it to work, and is willing to share this knowledge.
i tired to search but none came close to what i was looking for,.
or even if you only had an idea how to do this, it would be a great help
i thought about raycasts, but that would still have the problem of the bullet disapearing after it hit a wall :(
its for an ultimate weapon in my game, and i was wondering if anyone has gotten it to work, and is willing to share this knowledge.
i tired to search but none came close to what i was looking for,.
or even if you only had an idea how to do this, it would be a great help
i thought about raycasts, but that would still have the problem of the bullet disapearing after it hit a wall :(
#2
ie, you can tell a raycast to hit only People, Terrain, and DTS objects, but not to hit Interiors.
see tdn.garagegames.com/wiki/TorqueScript_Console_Functions_16
10/23/2006 (8:58 am)
In TGE, you can set the types of things a raycast will detect, and the same may be true for projectiles ?ie, you can tell a raycast to hit only People, Terrain, and DTS objects, but not to hit Interiors.
see tdn.garagegames.com/wiki/TorqueScript_Console_Functions_16
#3
The only way to even attempt it would be to try spawning a projectile when the original hits the interior.
Broken down..
Projectile is fired. Hits an interior (obviously it will explode because the engine tells it to).
::onCollision run a raycast from a vector slightly foward of the collision in the direction the first projectile was traveling. Keep adding to the vector until the raycast isn;t hitting anything.
Spawn new projectile.
Rinse repeat.
Hard to put inot words :(
10/23/2006 (6:45 pm)
Without an engine modification it gets pretty hacky..The only way to even attempt it would be to try spawning a projectile when the original hits the interior.
Broken down..
Projectile is fired. Hits an interior (obviously it will explode because the engine tells it to).
::onCollision run a raycast from a vector slightly foward of the collision in the direction the first projectile was traveling. Keep adding to the vector until the raycast isn;t hitting anything.
Spawn new projectile.
Rinse repeat.
Hard to put inot words :(
#4
10/23/2006 (8:32 pm)
I think Zods idea would work fine as long as you remember to not give the projectile an explosion. you could instead use the projectile's onCollision() callback and spawn the explosion manually on player impact.
Torque Owner Mark Junior