Matt Kemp
Reputation
1,232
Top tag
Next privilege 2,000 Rep.
 Jul 9 awarded Yearling Jul 9 awarded Yearling Jul 9 awarded Yearling Feb 14 answered How might I script the creation of CLR objects? Feb 6 answered How do I calculate consistent frame timings at 60fps? Feb 6 comment How do I calculate consistent frame timings at 60fps? It's not really enough for an answer, but take a rolling average and then truncate to be an integer? Feb 6 answered Run a physics simulation on both client and server? Feb 6 answered Centralized User database for multiple Systems Feb 5 comment 3d transformation of game world keeping gameplay 2d - COCOS2D 2.0 I thought the idea of Fez was that it was actually a 3D game? Everything was encoded in 3D, it just used an Orthographic projection (things don't get smaller in the distance) in comparison to a perspective projection (things do). Feb 5 answered Calculate intersection of a line with a plane Oct 22 awarded Nice Answer Aug 5 awarded Nice Answer Jul 23 awarded Nice Answer Jul 23 comment How does Dwarf Fortress keep track of so many entities without losing performance? +1 for this, for actually explaining what's going on, rather than wittering on about graphics like me. :) Jul 23 answered How does Dwarf Fortress keep track of so many entities without losing performance? Jul 20 comment Rotating a polygon around it's center You do this so the ship's centre is at (0,0). You turn the ship to the orientation you want first, and then move it to where you want it. Imagine you were using a drawing compass - if you set some length on it then rotating the compass around leaves a circle with the radius being the length. If your length was zero then the pencil is equivalently on the spot. Jul 19 answered Why is it a bad idea to store methods in Entities and Components? (Along with some other Entity System questions.) Jul 19 comment Tilting a platform on its axis? Note that this is acceleration of angle change, not velocity, so your calculation to get your new angle is to calculate the new velocity (`old_velocty + angular_acceleration*timestep`) and then apply this to get the new angle (`old angle + new_velocity*timestep`). You may also want to set a minimum and maximum angle your platform can turn to, or you might find that you get a propeller instead. :) Things like box2d will help here as they'll do a lot of the heavy lifting for you. May be worth a look for this kind of project. Jul 19 comment Tilting a platform on its axis? Almost. It's to do with moments and torque, especially in relation to angular momentum. Roughly, take `sin(angle of platform)` and multiply by the magnitude of the force (player mass * gravitational constant). From this you have torque, which is equal to the moment of inertia `I` (Bigger and heavier things have a bigger I, so turn slower) multiplied by angular acceleration. Divide by your chosen `I` for this platform (tweak it 'til it feels 'right') and you have the acceleration to apply to your angle variable. Jul 19 comment Rotating a polygon around it's center I forgot to mention - you don't need to un-do the position translation. Remove `gl::translate(Vec2f(-m_Pos.x, -m_Pos.y));` as well.