Tag Info

New answers tagged

0

The way I've handled issues like this in the past is to keep track of a "desired angle/orientation", and then each FixedUpdate I apply a torque to nudge the object toward that orientation. You might implement this with a negative feedback control system, or error-controlled regulation, where as the bike deviates further from the goal, you apply greater and ...


1

You have at least one error. This is incorrect: float newDistance = newPointOnPlane.x + newPointOnPlane.y + newPointOnPlane.z It should instead be: float newDistance = glm::dot(newPointOnPlane, newNormal); Because the "distance" of a plane is the distance along the normal to the plane origin, which is given by the dot product between the normal and the ...


0

take a look at Elastomania. I guess this is the game you want to replicate. there are some people with unbelievable skill at this game, check youtube :) Anyway you need to take a look at inertia tensor tool. its a matrix that characterizes the solid's inertia parameters. http://en.wikipedia.org/wiki/Moment_of_inertia In your case there are many terms that ...


-2

This page has fantastic explanations of different ways to update your game loop, the last one will show you how to make your logic update run independently from updating the screen. Hope it helps: http://www.koonsolo.com/news/dewitters-gameloop/


2

The trick here is conversion between world space and screen space. World space is the coordinate system you use for your game logic - calculations of pathing, movement, formations, etc. Your original formation code is correct for world space. Screen space is the coordinate system in which items are displayed. Because you're using an axonometric projection ...


0

I am working on similar project right now and I think that you have two problems. First is that you compute direction in a wrong way. Try changing signs before sin and cos. For example: if (event.key.keysym.sym == SDLK_w) { t.GetPos()->x += glm::sin(glm::radians(t.GetRot()->y)) * 0.5; t.GetPos()->z -= ...


1

You should probably use glm::angleAxis() (documentation here): glm::quat &rot = glm::angleAxis(glm::radians(90.f), glm::vec3(0.f, 1.f, 0.f));


1

the glm::quat(float, float, float, float); constructor doesn't do what you think it does. It sets the values directly. The values of the quaternion (w, x, y, z) are in order: the cosine of half the angle, the sine of half the angle times the x coordinate of the normalized rotation axis, and the same for the y ans z components. So instead you want to use ...


1

I need a way of translating a set of points P I suppose you mean rotating here? Let Z = (0,0,1). If cross(N,Z) has length 0, it means that all your points already lie in the desired plane. Otherwise we can build a basis of the target plane: U = normalize(cross(N,Z)) V = cross(N,U) Now to transform a point P = (x,y,0) so that it lies in your target ...


0

What are the effects of this: inline glm::mat4 GetModel() const { glm::mat4 matx; matx = glm::scale(matx, m_scaleV); matx = glm::rotate(matx, m_rotateV.x, glm::vec3(1.0, 0.0, 0.0)); matx = glm::rotate(matx, m_rotateV.y, glm::vec3(0.0, 1.0, 0.0)); matx = glm::rotate(matx, m_rotateV.z, glm::vec3(0.0, 0.0, 1.0)); matx = ...


1

http://stackoverflow.com/questions/1568568/how-to-convert-euler-angles-to-directional-vector This should answer the first part of your question. A simple google search gave me this result. For translating, you want to multiply the direction you want to move by the length you want to move. So, if you want to move forward by 5.0 units, you would write: ...



Top 50 recent answers are included