Problem with add object actuator

Hello everyone.

I’m working on a game where you play as a raptor. It’s coming along very nice so far, but I’ve run into a problem and can’t seem to figure it out. The raptor character is supposed to shoot balls of energy at enemies. This is what I’ve done. I’ve made a cube that serves as the energy ball originator. The cube is parented to the head bone in the raptor character. I’ve set up logic bricks in the raptor so that he plays a shooting animation and at the same time I’ve set up logic bricks in the cube so that the energy ball object is added when the fire key is pressed. I’ve tested the game and it works well at first, but when I turn the raptor in the opposite direction, he goes flying backward along with the energy ball.

The two problems are as follows:

One–the energy ball always shoots in the same direction, no matter which way I turn my character and…

Two–when I turn the raptor in the opposite direction while playing the game, he goes flying backwards with the energy ball he shoots.

Can anyone help?

Thank you.

Just click the “L” button next to the stating velocity buttons.

It could be a variety of things. Can you post a .blend?

in the add object actuator clik the L butten making the actuator spawn localy
aiming it the way the rapter is facing.

hope this helps.

whoops took me so long to post some one already answered!

I had this problem too. The way I solved it is by using an empty to add the “bullet” object. Put the empty directly in front of your player (wherever you want the bullets to appear) and parent the empty to your player character (so it moves with it), then use a Python script to determine the vector from your player to the empty (i.e. the vector that represents the direction in which your bullet should travel). Normalize the vector (by dividing each component by the vector’s magnitude), and then multiply each component of the vector by whatever you want the velocity of your bullet to be. What you end up with is a velocity vector for your bullet which you can then use to set the linear X,Y and Z velocities of your add object actuator (have to do this in code).

I’m at work right now so can’t post a code example. I’ll try to post one later.

Hmmm… just read Littlebob’s post. Didn’t know you could do it that way, but it sounds alot easier…:slight_smile:

Thanks guys. Looks like the problem’s solved.:slight_smile: