12271
Support / Some helpful Object3D,Camera, and SimpleVector functions
« on: March 19, 2003, 07:47:41 am »
I guess what you want to do is to align a projectile (or another object) in a way so that it points into the direction of the camera (or an Object3D). Like firing a rocket from your ship into the ship's direction!?
I'll think about it later (don't have much time now...maybe next week).
About this part of your code:
...calling toArray() is not needed here. The x, y and z components of a SimpleVector are public members (for performance reasons), so you can access them directly like this:
Edit: I think i'm going to add the requested scale()-method to SimpleVector anyway...
I'll think about it later (don't have much time now...maybe next week).
About this part of your code:
Code: [Select]
forward=zaxis.toArray();
sphere1.translate(forward[0]*.2f,forward[1]*0.2f,forward[2]*0.2f);
...calling toArray() is not needed here. The x, y and z components of a SimpleVector are public members (for performance reasons), so you can access them directly like this:
Code: [Select]
sphere1.translate(zaxis.x*.2f, zaxis.y*0.2f, zaxis.z*0.2f);
Edit: I think i'm going to add the requested scale()-method to SimpleVector anyway...