• Create Account

We're offering banner ads on our site from just \$5!

# mmurphy

Member Since 09 Oct 2011
Offline Last Active Nov 09 2012 01:06 AM

### Attempting to learn about car turning

09 November 2012 - 01:06 AM

I am attempting to learn how to deal with car turning, but I am failing to find a resource that takes it from the beginning to end. I am not looking to have a 100% simulated version, but something that "looks right". I went through the search here and found the thread http://www.gamedev.net/topic/484191-physics-of-a-turning-car/ where Hodgman linked a resource of http://www.gamedev.net/reference/programming/features/2dcarphys/ but it appears that is no longer available.

Are there any available resources that teach how do implement a car turning from start to finish?

### How should my texture sampler be for rendering a bitmap font/sprite?

10 June 2012 - 03:49 PM

I have a texture and was curious as to what the texture sampler should be for sampling the sprite texture? I am using DirectX11, though if you know what it should be for DX9/10, I believe it is transferable.

I tried
ComparisonFunc = D3D11_COMPARISON_NEVER
Filter = D3D11_FILTER_MIN_MAG_MIP_POINT
MaxAnisotropy = 1;
MaxLOD = D3D11_FLOAT32_MAX;
MinLOD = 0;
MipLODBias = 0;

Although when rendering, there appeared to be artifacts and it did not seem as clear as it should be.

### Calculating and applying friction

06 December 2011 - 12:36 AM

I have been researching how to apply friction and there is a part I am stuck on, which is how to apply that friction to the velocityy (if in fact I am calculating the friction force correctly that is).

When I have a ball on a surface, with a normal of (0, 1, 0), with a present velocity of (2, 0, 0) then I will calculate my friction force as (0, -0.3, 0). However, what I don't understand is how to properly apply that to my velocity. If I simply, subtract it then my velocity will be (2, -0.3, 0), however, shouldn't the friction be cause the x component to be more less?

Here is my current code, if anyone could please take a look at I would greatly appreciate it. There are some optimizations to be made, I am aware of that.

```	mTotalForces = D3DXVECTOR3(0.0f, 0.0f, 0.0f);

D3DXVECTOR3 vSurfaceNormalized;
D3DXVec3Normalize(&vSurfaceNormalized, &vSurfaceNormal);
D3DXVECTOR3 vFrictionForce(0.0f, 0.0f, 0.0f);

D3DXVECTOR3 forceAndVelocity = mTotalForces + m_vVelocity;
float fVelocityMagnitude = sqrt((forceAndVelocity.x * forceAndVelocity.x) + (forceAndVelocity.y * forceAndVelocity.y) + forceAndVelocity.z * (forceAndVelocity.z));
float fFrictionForceMagnitude = 0.0f;
float fFrictionForce = 0.0f;

if(fVelocityMagnitude == 0.0f)
{
fFrictionForce = m_fStaticFrictionCoefficient;

D3DXVECTOR3 vStaticFriction = -m_fStaticFrictionCoefficient * vSurfaceNormalized;
vFrictionForce = vStaticFriction;
}
else if(fVelocityMagnitude > 0.0f)
{
fFrictionForce = m_fKineticFrictionCoefficient;

D3DXVECTOR3 vKineticFriction = -m_fKineticFrictionCoefficient * vSurfaceNormalized;
vFrictionForce = vKineticFriction;
}

{
float fFrictionForceMagnitude = abs(fFrictionForce * D3DXVec3Dot(&vSurfaceNormalized, &forceAndVelocity));

if(fFrictionForceMagnitude > fVelocityMagnitude)
{
fFrictionForceMagnitude = 0.0f;
m_vVelocity = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
}
else
{
m_vVelocity -= vFrictionForce;
}
}
```

I make the total force zero at the start of this friction function because if there is friction, then the previous force (gravity) should not influence the velocity later. (... right?)

### Calculating and applying forces

04 December 2011 - 10:34 PM

I am working on the way forces are used in my physics engine and was hoping possible someone could comment if this was general idea (it seems to be from what I gathered from other physics engine/docs)

Apply Gravity to total forces

Calculate Collisions (using total force + velocity for detecting collision)
- If there is a friction, add the friction force to total force
- If there is resting, subtract out the gravity from total force

Calculate acceleration as “acceleration = total force/mass”
Calculate velocity as “velocity += acceleration * dt
Calculate new position as “new position = current position + velocity”

Set total forces to zero, set acceleration to zero.

Edit: corrected my acceleration formula

### [DX11] Rendering to multiple windows

28 November 2011 - 12:25 AM

With DirectX11, how would it be possible to rendered to two different windows while using the same device? I see how it would be possibly in DX9 in various places, but not in DX11.

PARTNERS