Fireball Spell

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Garold
Posts: 60
Joined: Fri Sep 23, 2011 5:17 pm
Location: Liverpool, England

Fireball Spell

Post by Garold »

I'm finally adding the spells to my game! The first of which is a fireball cast by a witch :)

Should I be using the Thruster class, as seen in Spaceship demo?

The only foreseeable issue I can imagine is gravity. I want the fireball to have a considerable mass, in that it can physically smash entities, yet at the same time I want it to move quite slowly, only about 30 units per second.

Could I add two Thrusters, one to push it in the direction and one to push it up?

Maybe, I could switch gravity off, then it would travel nicely in a straight line, then after a certain distance, switch gravity on and switch off the thruster? That way it would eventually fall to ground.

What do you think?

Help me Norbo-Wan Kenobi, you're my only hope.
BEPUphysics rules my world
http://cloneofduty.com
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Fireball Spell

Post by Norbo »

Help me Norbo-Wan Kenobi, you're my only hope.
I will try to help! Wait, I mean, not try, I'll... do, to help?
Should I be using the Thruster class, as seen in Spaceship demo?

The only foreseeable issue I can imagine is gravity. I want the fireball to have a considerable mass, in that it can physically smash entities, yet at the same time I want it to move quite slowly, only about 30 units per second.

Could I add two Thrusters, one to push it in the direction and one to push it up?
Thrusters are made for applying a continuous force, so if you want the fireball to launch and then gradually and continuously accelerate, it would be a good option.

Setting the Entity.IsAffectedByGravity to false would be the easiest way to stop gravity from pulling it down.

If you want custom flight behavior, I would just set the LinearVelocity directly to whatever speed/direction you want. Then, if you want gravity later, start adding the desiredGravity * dt to the LinearVelocity each frame.
Post Reply