Foolish Posted March 15, 2010 Share Posted March 15, 2010 I have been mining the forums for information on how to move objects in 3D space. I thought it was a significant enough topic to merit its own space. For example, if I have two objects and I want to move object A to Object B's location. Is there an easy way to determine the vector I would need to set for SetBodyVelocity or even MoveEntity if I wasn't using Physics? Quote Windows XP Dual Core 2.66 Dual GeForce 7900 GTS in SLI (Yes, I know they are old.) Blitzmax with BlIDE Link to comment Share on other sites More sharing options...
Rick Posted March 15, 2010 Share Posted March 15, 2010 For non physics you can interpolate a number of steps between A & B and then each frame call SetPosition() along those steps. If the steps are small enough it will produce the same as MoveEntity and seem smooth. Quote Link to comment Share on other sites More sharing options...
Foolish Posted March 15, 2010 Author Share Posted March 15, 2010 Thanks Rick. I think I saw you had a post on this somewhere. I'll see if I can find it again. Also, I was checking out your latest Thingoid video. Good stuff I am looking forward to checking out further. For non physics you can interpolate a number of steps between A & B and then each frame call SetPosition() along those steps. If the steps are small enough it will produce the same as MoveEntity and seem smooth. Quote Windows XP Dual Core 2.66 Dual GeForce 7900 GTS in SLI (Yes, I know they are old.) Blitzmax with BlIDE Link to comment Share on other sites More sharing options...
Rick Posted March 15, 2010 Share Posted March 15, 2010 Good stuff I am looking forward to checking out further. Thanks. I really am hoping some members of the community can take it further and start making their own thingoids to share. The more the better Quote Link to comment Share on other sites More sharing options...
Foolish Posted March 15, 2010 Author Share Posted March 15, 2010 One of the problems getting out the starting gate for me has been these simple navigation issues. There aren't really to many examples to learn from. Right now, I am trying to move a spaceship in 3D space. I can certainly move it using things like setvelocity, but its been difficult to figure out how to navigate to a specific point. With all of the complex problems people discuss on the forums, maybe this is too simple? In two dimensions, I suppose I can figure out the angle using the arctangent. In 3 dimensions, I guess this would be something similiar. Then I guess I can use set velocity. These things will get me from point a to point b, but then I need to apply a torque to get the ship to rotate and face the direction of movement. I was thinking that to keep the ship facing the right direction I would be continuously checking the angle and adding torque to keep pitch and roll where they need to be. Anyway, if anybody has done this before and can validate this approach, let me know. Better yet, if you have an example, I wouldn't mind seeing that either. Quote Windows XP Dual Core 2.66 Dual GeForce 7900 GTS in SLI (Yes, I know they are old.) Blitzmax with BlIDE Link to comment Share on other sites More sharing options...
Foolish Posted March 16, 2010 Author Share Posted March 16, 2010 Okay, I'm onto something now. CalcBodyVelocity lets me get a vector for the velocity to a position I give it. Progress. One of the problems getting out the starting gate for me has been these simple navigation issues. There aren't really to many examples to learn from. Right now, I am trying to move a spaceship in 3D space. I can certainly move it using things like setvelocity, but its been difficult to figure out how to navigate to a specific point. With all of the complex problems people discuss on the forums, maybe this is too simple? In two dimensions, I suppose I can figure out the angle using the arctangent. In 3 dimensions, I guess this would be something similiar. Then I guess I can use set velocity. These things will get me from point a to point b, but then I need to apply a torque to get the ship to rotate and face the direction of movement. I was thinking that to keep the ship facing the right direction I would be continuously checking the angle and adding torque to keep pitch and roll where they need to be. Anyway, if anybody has done this before and can validate this approach, let me know. Better yet, if you have an example, I wouldn't mind seeing that either. Quote Windows XP Dual Core 2.66 Dual GeForce 7900 GTS in SLI (Yes, I know they are old.) Blitzmax with BlIDE Link to comment Share on other sites More sharing options...
Naughty Alien Posted March 17, 2010 Share Posted March 17, 2010 ..maybe if you could post some drawing of your ship, with vector forces drawn at points where they affecting ship for sake of control, i could help..I did similar stuff for canoe control in my game where canoe were affected based on real world control concept of canoe.. 1 Quote Link to comment Share on other sites More sharing options...
Foolish Posted March 19, 2010 Author Share Posted March 19, 2010 I bet it will be familiar. I am using a TIE Fighter from the classic Star Wars trilogy. I will get that image in here ASAP. In the meantime, I have playing around with the CalcBodyVelocity and SetBodyVelocity. I added a list of waypoints for the TIE Figher to follow. Unforunately, I can't figure out how to set a "constant velocity". My ship is decelerating as it gets close to the waypoint. My logic is as follows. 1. Identify the next way point. 2. Calculate the velocity. Set the velocity. Note that I calc and set the velocity once for each waypoint. 3. Each update cycle, check to see if my distance from the pivot is <=1. If so, go back to step 1. Overall, this is probably not the way to do it, but I am still playing. Quote Windows XP Dual Core 2.66 Dual GeForce 7900 GTS in SLI (Yes, I know they are old.) Blitzmax with BlIDE Link to comment Share on other sites More sharing options...
Foolish Posted March 28, 2010 Author Share Posted March 28, 2010 I changed directions a little bit and started focusing on piloting the ship manually as opposed to workign on AI controlled ships first. So getting some basics down were pretty easy. The third person cam was just: 'Position Camera PositionEntity(cam, EntityPosition(thismodel.model)) RotateEntity(cam, EntityRotation(thismodel.model)) MoveEntity(cam, Vec3(0, 1, - 2.5)) I have a Type for my TIE Fighter. The model needed the following characteristics: EntityType model, 1 SetBodyMass model, 10 SetBodyDamping(model, 1, 2) The first param is linear damping and the second is angular. SetBodyGravityMode model, False 'no falling in space. SetBodyFriction (model, 0, 0) In the update method, I just use the following to steer: pitch = (KeyDown(KEY_UP) - KeyDown(KEY_DOWN)) * 200 yaw = (KeyDown(KEY_RIGHT) - KeyDown(KEY_LEFT)) * 200 roll = (KeyDown(KEY_Z) - KeyDown(KEY_X)) * 250 AddBodyForce(model, Vec3(0, 0, 700), 0) AddBodyTorque model, Vec3(pitch, yaw, roll), 0 The AddBodyForce is thrust and the torque obviously impacts the orientation. Using physics forces on Star Wars ships makes for an interesting flight experience that I think will make the dog fighting interesting. The attached screenshot shows my place holder graphics of a TIE fighter flying over the Death Star surface. I bet it will be familiar. I am using a TIE Fighter from the classic Star Wars trilogy. I will get that image in here ASAP. In the meantime, I have playing around with the CalcBodyVelocity and SetBodyVelocity. I added a list of waypoints for the TIE Figher to follow. Unforunately, I can't figure out how to set a "constant velocity". My ship is decelerating as it gets close to the waypoint. My logic is as follows. 1. Identify the next way point. 2. Calculate the velocity. Set the velocity. Note that I calc and set the velocity once for each waypoint. 3. Each update cycle, check to see if my distance from the pivot is <=1. If so, go back to step 1. Overall, this is probably not the way to do it, but I am still playing. Quote Windows XP Dual Core 2.66 Dual GeForce 7900 GTS in SLI (Yes, I know they are old.) Blitzmax with BlIDE Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.