edit: if you take another look at the project (just register a new user if you cant remember your password. like i said, there will be hundreds of wipes) i removed the ship moving and instead placed an axisHelper. note i have set the radius, or length of the vector to a hardcoded value, i did this to make the problem more visible, it shouldnt affect the formula.

]]>If yes, that means that the velocity vector has to have a default starting orientation. What did you choose for that orientation?

]]>i set a euler (x, y and z rotation of the ship, relative to the world, in radians) by converting quaternions.

now i need to use those angles plus a velocity to calculate the end point of the velocity vector.

i've made some minor modifications to the code, the axis you're seeing should always be in front of the ship.

if this still doesnt clear it up, i give up, cant explain it, thanks for trying tho.

]]>I'm still having problems understanding exactly what is needed.

What are the three angles? How are they measured? Can you supply a diagram ?

Is the ship moving forward properly apart from direction?

Bob

]]>well, its very much in development, the intention is to make it mmo and give the player missions to gain levels and money to modify his or her ship to become better at blowing up other ships. create alliances to work together, etc. so its not as much a simulator as it is a game, it just fits into the category space sim.

the engines are just visuals, they dont do anything but look pretty, i'm using a physics engine (cannon.js), when rotating i give the ship an angular velocity, and indeed, once an object is in motion it stays in motion unless acted upon by another force, the physics engine does this as well, i gave it friction to allow for more control (i still have to make the visuals for slowing down the ship, both velocity and angular velocity. i'm quite satisfied about the rotation and the control over it. the problem is the velocity vector of the ship, seeing as im using two angles where i should be using three, the direction is off. for simplicity's sake, lets say the ship should always be moving forward.

let me try it this way because i just cant seem to explain the problem properly, and i apologize. it feels like trying to explain something in a foreign language.

to calculate the x, and y coordinates on a circle you have only one angle:

X = radius * cos(angle)

Y = radius * sin(angle)

to calculate the point on a sphere you need at least 2 angles:

X = radius* cos(beta) * cos(alpha);

Y = radius* cos(beta) * sin(alpha);

Z = radius* sin(beta);

now i need a way to do the same, but with all 3 angles (representing the rotation of the ship). i have a feeling the answer is staring me right in the face, but i don't understand sine cosine and tangent well enough to figure it out, though im learning fast.

]]>I'm no gamer and my programming is 'out the ark', so you'll have to excuse me if I ask obvious questions.

I've looked at your development. Nice graphics. Especially like the spinning Earth. I played with the arrow keys and observed that the space ship can be made to pitch and yaw. In space there's effectively no friction so once you start a motion it carries on until you introduce the opposite motion. I couldn't get control well enough to be certain about this.

So what is the mission? To 'home in' on the Earth and maybe land ? With the car racing games I've seen, the car graphic is fixed and the background moves, giving the illusion that you're the driver hurtling round the track. If you did the same, then all those nice graphics for the underside of the ship are wasted. On the other hand, if you don't 'move the Earth', you won't be able to home in on it.

I see four rocket engines and once started, they kept on firing for me. But in the Apollo missions they did short 'burns' and let the craft take up a new position. If I call the engines (clockwise from top left) 1, 2, 3, and 4; then I'm imagining that 1+4 will make the craft yaw to the right, and 2+3 will cancel this. 1+2 to pitch down and 3+4 to cancel that. So 1+2+3+4 would make the craft go forwards. How will it slow down/stop ?

If that's the mission I would give the player control of the four engines and translate 'burns' into movements of the background (left-right, up-down, closer). I don't see why you need quaternion rotation at all.

As you can see, I'm still not understanding the question yet. To come back to your original question, you can convert a vector into a new one that is relative to a moving point just by addition.

eg. If a train is travelling at 60 relative to the track, and a passenger walks forward along the length of the train at 3 relative to the train, then the motion of the passenger relative to the track is 63.

In general, if a point, P, moves with vector u relative to a point A; and A moves at vector v relative to point B; then P moves at u+v relative to B

At the moment, I see space fixed (including the Earth) and the ship moves relative to this. I'm assuming you want the ship to be the fixed, and space to move, so that we see the journey from the perspective of the pilot.

Over to you.

Bob

]]>