Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualnfactorial

Posted 15 June 2013 - 05:17 AM

Hey,

  The code only makes some vague sense in that I can see what you're trying to do but it doesn't work like that. Unless the Vector3 and Matrix classes you're using has some implementation unknown to me.(which is completely possible!).

 

You appear to be adding matrices together? I would guess you meant to concatenate them (ie. multiply?)

 

Rather than try to concatenate in this way, create your position as a vector separately from the orientation then combine them together at the end by multiplying the translation matrix (created from your position vector) and your rotation matrix. Your object should maintain the position vector and orientation (in whichever format you choose to represent it) as member variables.

 

I am not sure what your Forward/Backward/Left properties are, it looks like they're vectors extracted from your matrix.This wont work if the matrix you're extracting them from is the concatenated matrix we see in your Player.Update method. However it should be fine if you use the rotation as I mention above.

 

A couple of things to think about after you have the basic camera working:

 

With your current implementation, you will have a *very* rigid camera and you will want to add some kind of 'tightness' control.

You will want to have some kind of adjustment for the target point on the object being looked at, looking directly at the object will make it difficult to see where you are going.

 

n!

[edit] The forum lost half my original post, but I think I remembered the bits that disappeared.


#5nfactorial

Posted 15 June 2013 - 05:15 AM

Hey,

  The code only makes some vague sense in that I can see what you're trying to do but it doesn't work like that. Unless the Vector3 and Matrix classes you're using has some implementation unknown to me.(which is completely possible!).

 

You appear to be adding matrices together? I would guess you meant to concatenate them (ie. multiply?)

 

Rather than try to concatenate in this way, create your position as a vector separately from the orientation then combine them together at the end by multiplying the translation matrix (created from your position vector) and your rotation matrix. Your object should maintain the position vector and orientation (in whichever format you choose to represent it) as member variables.

 

I am not sure what your Forward/Backward/Left properties are, it looks like they're vectors extracted from your matrix.This wont work if the matrix you're extracting them from is the concatenated matrix we see in your Player.Update method. However it should be fine if you use the rotation as I mention above.

 

A couple of things to think about after you have the basic camera working:

 

With your current implementation, you will have a *very* rigid camera and you will want to add some kind of 'tightness' control.

You will want to have some kind of adjustment for the target point on the object being looked at, looking directly at the object will make it difficult to see where you are going.

 

n!


#4nfactorial

Posted 15 June 2013 - 05:15 AM

Hey,

  The code only makes some vague sense in that I can see what you're trying to do but it doesn't work like that. Unless the Vector3 and Matrix classes you're using has some implementation unknown to me.(which is completely possible!).

 

[edit] Hmmm, the forum lost half my post - re-adding it now.

 

You appear to be adding matrices together? I would guess you meant to concatenate them (ie. multiply?)

 

Rather than try to concatenate in this way, create your position as a vector separately from the orientation then combine them together at the end by multiplying the translation matrix (created from your position vector) and your rotation matrix. Your object should maintain the position vector and orientation (in whichever format you choose to represent it) as member variables.

 

I am not sure what your Forward/Backward/Left properties are, it looks like they're vectors extracted from your matrix.This wont work if the matrix you're extracting them from is the concatenated matrix we see in your Player.Update method. However it should be fine if you use the rotation as I mention above.

 

A couple of things to think about after you have the basic camera working:

 

With your current implementation, you will have a *very* rigid camera and you will want to add some kind of 'tightness' control.

You will want to have some kind of adjustment for the target point on the object being looked at, looking directly at the object will make it difficult to see where you are going.

 

n!


#3nfactorial

Posted 15 June 2013 - 05:04 AM

Hey,

  The code only makes some vague sense in that I can see what you're trying to do but it doesn't work like that. Unless the Vector3 and Matrix classes you're using has some implementation unknown to me.(which is completely possible!).

 

[edit] Hmmm, the forum lost half my post - re-adding it now.

 

1st -

 

 

if (kbs.IsKeyDown(Keys.W))

{
playerWorld += Matrix.CreateTranslation(Vector3.Forward * speed * dt);
}


#2nfactorial

Posted 15 June 2013 - 05:04 AM

Hey,

  The code only makes some vague sense in that I can see what you're trying to do but it doesn't work like that. Unless the Vector3 and Matrix classes you're using has some implementation unknown to me.(which is completely possible!).

 

[edit] Hmmm, the forum lost half my post - re-adding it now.

 

1st -

 

 

if (kbs.IsKeyDown(Keys.W))

{
playerWorld += Matrix.CreateTranslation(Vector3.Forward * speed * dt);
}


#1nfactorial

Posted 15 June 2013 - 05:03 AM

Hey,

  The code only makes some vague sense in that I can see what you're trying to do but it doesn't work like that. Unless the Vector3 and Matrix classes you're using has some implementation unknown to me.(which is completely possible!).

 

1st -

if (kbs.IsKeyDown(Keys.W))

{
playerWorld += Matrix.CreateTranslation(Vector3.Forward * speed * dt);
}


PARTNERS