Ask a Question related to Macromedia Director 3D, Design and Development.
-
Mazuho #1
Rotating issues
In a 3dgame I am currently developing I am having a bullet "spawn" from a model
resource every time the user shoots with his/her tank. Let's say that when the
game starts the turret is in position A. The user rotates the turret x degrees
and fires, and the bullet should fly away in the direction the barrel is
pointing in. My problem now is that the bullet always goes in the same
direction. It gets spawned from the tip of the barrel just as it should, but if
I make a 180 degree turn, the bullet flies into the tank instead.
This is the code for positioning the bullet when it gets spawned:
bullet = w.newmodel("bullet"&string(pcount), bulletR)
bullet.worldposition = w.model("turrettarget").worldposition
--pTurretEnd is a small invicible box at the end of the barrel
This is the code for the trajectory of the bullet:
--BulletV = vector(-20,0,0) BulletH = vector(0,0,0.1)
bullet.transform.translate(BulletV)
bullet.transform.translate(BulletH)
Any ideas?
Mazuho Guest
-
Rotating Problem
- I have a a model that rotates by pressing the left- and right arrowkeys. - Now I have a second model that keeps rotating (automatically) until it... -
Rotating text
I used to be able to rotate text as well as the text block using the Selection tool. Now the block rotates, but the text does not. Is there a... -
Rotating
how do I rotate a primitive/model without rotating it's own axis system. example - When creating a cone, it is created with it's sharp end pointing... -
Rotating Phrase Box
I'm trying to make an animation that rotates phrases every five minutes or so. Is a flash animation the way to go? Any suggestions? -
Rotating Banner Ads
How do I set up rotating banner ads? Thanks, Brad ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ropeofsilicon.com -
Mazuho #2
Re: Rotating issues
Okay, I solved it by doing the following:
1. Getting a vector from the beginning of the barrel.
2.Getting a vector from the end of the barrel.
3. vector c = vector a - vector b
4. normalized vector c
5. translated the bullet along the direction vector now aquired (vector c)
Hope someone finds this useful
Mazuho Guest



Reply With Quote

