Game Development Community

Arrow behavior

by Peter Daunt · in Torque Game Engine · 03/11/2007 (12:15 pm) · 2 replies

Hi.

I've asked that question before but in a wrong forum, I am certain that in this forum I'll get a specific help. I am just starting with TGE and I know only basics.. so here's my question: How can I add a real arrow behaviour, i mean arrow gravity, the wind affect, bouncing off the concrete or stuck into wood? Is it possible?

About the author

Recent Threads

  • Arrow behavior

  • #1
    05/11/2007 (1:54 pm)
    Projectiles can have gravity turned on. See the ProjectileData type datablock, in the Starter.fps starter kit, see server/scripts/crossbow.cs
    isBallistic = true;
    should do it.

    The projectiledata block can have an oncollision method.

    I had to make code changes to save a recent velocity vector to determine the attitude of the projectile upon striking a target. There may be a way to do this in script, but it wasn't obvious to me. (Upon striking, the velocity is zeroed.)

    You could then create new arrow objects to leave stuck in terrain, or bounce off the terrain, etc. You need to be careful about that. If you shoot a car naively , the car can then drive away leaving the arrows floating in the air. ;)

    Wind would I expect be added through code changes to the projectile class and adding a wind system, etc.
    #2
    05/11/2007 (4:18 pm)
    I think that Torque already has wind built in right out of the box - try looking at the sky object in the editor. I also believe that Projectiles are affected by this wind too.

    --Amr