Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Koga73

Member Since 04 Mar 2009
Offline Last Active Mar 07 2013 10:20 PM

Posts I've Made

In Topic: translate point set distance towards quaternion

10 December 2012 - 04:59 PM

Yeah as for rotating zero in my example I know it doesn't do anything it was just easy math for me to show what I expect the resulting point to be. As you stated above applying the rotation to (distance, 0, 0) does work!

var quat:Quaternion = new Quaternion();
quat.fromAxisAngle(new Vector3D(0, 1, 0), rot * MathConsts.DEGREES_TO_RADIANS);
  
var mat:Matrix3D = new Matrix3D();
mat.position = new Vector3D(10, 0, 0);
mat.append(quat.toMatrix3D());

plane.position = mat.position;

This is good and all but now I want to abstract it out into a function that takes in an axis vector, an angle, and a distance. It doesn't seem like the same code above would work if the axis were not the Y due to the position being hard-coded to (distance, 0, 0). I guess at this point I'm just looking for what that vector should be? The magnitude should always be the distance but does it matter what value I start it at?

In Topic: translate point set distance towards quaternion

10 December 2012 - 04:27 PM

In my case I have an XZ plane with the normal facing +Y.

I am using the following for my quaternion:
var quat:Quaternion = new Quaternion();
quat.fromAxisAngle(new Vector3D(0, 1, 0), rot * MathConsts.DEGREES_TO_RADIANS);
var mat:Matrix3D = quat.toMatrix3D();

So now I have a rotation matrix... I am wanting to make the plane orbit around the origin... so for instance if my distance is 10 units and my origin is (0, 0, 0) and my angle is 0° then I would expect the plane's resulting position to be (10, 0, 0).

I'm just not sure how to actually apply the distance and quaternion to get the planes resulting position?

In Topic: UV Mapping fundamentals

01 September 2011 - 03:14 PM

Thanks for the reply.

I get that part.. the part I don't understand is how it projects the texture on a surface with perspective.


In Topic: calc velocity on inclined plane with friction

13 May 2010 - 01:31 PM

Alright so I've really been struggling with getting the friction working over the past couple days. The problem I'm having is that the acceleration is half the max speed, so it will take half a second to reach max speed. That all works in a frictionless world... but as soon as I apply friction the friction value almost cancels out the acceleration so it takes FOREVER to reach max speed from a stationary position. On the same note, if I turn down the friction value then the player accelerates fine, but then slides and doesn't stop. I am having the hardest time finding a good mid-ground. Or perhaps I need a different approach.

My Friction Function (actionscript 3):


public static function applyFriction(toPawn:Pawn, overTime:Number):void {
if (!toPawn._onPhysical){
return;
}
if (toPawn._speed._MPS._x == 0){
return;
}

var tSpeedModifierX:int = toPawn._speed._MPS._x / Math.abs(toPawn._speed._MPS._x);
var tFrictionCoefficient:Number = toPawn._friction * toPawn._physicalBelow._friction;
var tFriction:Number = -(15) * tFrictionCoefficient;
var tDeceleration:Vector2D = new Vector2D((tFriction * tSpeedModifierX), 0);

applyAcceleration(toPawn, overTime, tDeceleration);

if ((toPawn._speed._MPS._x / Math.abs(toPawn._speed._MPS._x)) != tSpeedModifierX){
toPawn._speed._MPS._x = 0; //Check to see if we have gone past 0
}
toPawn._speed.calcMPS();
}

In Topic: calc velocity on inclined plane with friction

07 May 2010 - 05:35 AM

So I got most of it working. The thing that I am not seeing with your example is mass. The deceleration due to friction should take into consideration the mass of the object. As in the real world it will take much longer for a semi truck to stop than a car. Any suggestions to how mass can be worked in to work with friction?

PARTNERS