fguihen Posted December 26, 2004 Posted December 26, 2004 ok. i have gotten some answers to this on other boards but its all in c++ and older directX ( Not directX9 & c#, which is all i know).my problem is i have a charachter. at the moment he is in a room. when he hits a wall ( or before) he is going to turn to avoid the colission. the problem is keeping the charachter always facing the direction that he/she is travelling. i am viewing the scene from a fixed position over head. the only things i have to work with is my current position, my last position and the fact that the charachter can not move along the y axis ( i am not giving the ability to jump).can anyone help with this, in as simple a way as possible, using directX 9 ( and hopefully c#)? thanks all Quote
ThePentiumGuy Posted December 26, 2004 Posted December 26, 2004 Hey, All you have to do is simply rotate the character. d3ddev.transform.world = MapMatrix RenderMap() d3ddev.transfrom.world = matrix.rotation(Matrix.Multiply(characterPosition, characterRotation)) RenderCharacter The characterRotation matrix wuold be some Matrix.RotationYawPitchandRoll matrix and the characterPosition would be some Matrix.Translation matrix. I'm not 100% sure if it's: Matrix.Multiply(characterPosition, characterRotation) or Matrix.Multiply(characterRotation, characterPosition) I'm assuming, since you said that the camera is always fixed that your view matrix is a matrix.lookatLH or RH with a constant camreaPosition CamreaTarget and cameraTarget. -The Pentium Guy Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.