Hey all,

Right now I'm attempting to get a bullet to fire forward from a model in the direction of the mouse. I had this working previously using code similar to this:

findRotation = transform()
findRotation.rotate(vector(0,0,0), vector(0,0,1), float(pGunAngle.z))
bulletAngle = findRotation * vector(1,0,0)
bulletDirection = bulletAngle

-- spawn a script object that represents the bullet
thisBullet = new(script "Bullet Object", newBullet, bulletDirection, pGun)

-- add that object to the bullet list
pBulletList.add(thisBullet)


Where pGunAngle.y is the direction the model is facing [torwards the mouse]. However, my new models are trying to do the same thing with the Z axis instead of the Y. When I type this:

findRotation = transform()
findRotation.rotate(vector(0,0,0), vector(0,1,0), float(pGunAngle.y))
bulletAngle = findRotation * vector(1,0,0)
bulletDirection = bulletAngle

-- spawn a script object that represents the bullet
thisBullet = new(script "Bullet Object", newBullet, bulletDirection, pGun)

-- add that object to the bullet list
pBulletList.add(thisBullet)

The bullet does not fire a full 360 degrees around the model.

Here's the "Bullet Object" script, for further referance. I've tried looking at the firing example on 3Dd and DirectorDev, but nothing has helped. Any suggestions?

Bullet Object:

property pMyBullet, pOriginalTransform, pDestinationTransform, pInterpolationPctg
global gGunDisappear
global gCheck


on new (me, thisBulletModel, thisBulletDirection, thisGun)

-- initialize properties
pMyBullet = thisBulletModel
pInterpolationPctg = 0
pMyBullet.worldPosition = thisGun.worldPosition

-- store a copy of the bullet's origin point transform


pOriginalTransform = pMyBullet.transform.duplicate()

gCheck = thisBulletDirection

-- move the bullet to a final possible position
pMyBullet.translate(thisBulletDirection * 300, #world )
-- grab the final transform
pDestinationTransform = pMyBullet.transform.duplicate()
-- reset the bullet to its original transform
pMyBullet.transform = pOriginalTransform

-- register for stepFrame events in order to animate the bullet along its path
(the actorList).add(me)

-- return an object reference
return me

end new

on stepFrame (me)

-- calculate the new interpolation percentage
if gGunDisappear = 1 then
pInterpolationPctg = 100
gGunDisappear = 0
end if
pInterpolationPctg = pInterpolationPctg + 15

-- if we haven't reached the end of the flight then interpolate the bullet
-- otherwise kill the bullet
if (pInterpolationPctg <= 100) then

-- make a copy of the original transform
currentTransform = pOriginalTransform.duplicate()

-- interpolate the current transform towards the final by the appropriate amount
currentTransform.interpolateTo(pDestinationTransfo rm,pInterpolationPctg)

-- push this new current transform onto the bullet model
pMyBullet.transform = currentTransform.duplicate()

else

-- remove this item from the actorList
thisPosn = (the actorList).findPos(me)
(the actorList).deleteAt(thisPosn)

-- message the sprite to kill the bullet model and to remove this object
-- from its list of bullets
sendAllSprites(#deleteBulletModel,pMyBullet,me)

end if

end stepFrame