2 registered members (M_D, AndrewAMD),
1,222
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Animation frames blending, player input/physics
#64738
02/21/06 06:25
02/21/06 06:25
|
Joined: Aug 2000
Posts: 7,490
Orange Brat
OP
Senior Expert
|
OP
Senior Expert
Joined: Aug 2000
Posts: 7,490
|
This provides a couple different types of player movement...camera relative(keyboard or gamepad modes only...for Splinter Cell style satellite camera movement) and character relative. It also can be used with either a gamepad, keyboard only, or a mouse/keyboard combo. It also smoothly blends the player's bones animation states between one another. In other words, the transition from a standing animation to a run is smooth and not sudden. It's coded to handle idle, stand, walk, run, left turn, and right turn. It also plays a footstep sound for both walking and running. Note that there is no camera provided, although it does require the default "camera" when using camera relative modes. The various sensitivities, keyboard assignments, and the movement type(gamepad, keyboard, mouse/keyboard, camera/character relative) should be changed in the the "loadControlsDefault" function and not with the VAR itself. This function is the first thing that gets called, and all of the default values are handled within it. It then calls the "setKeys" function which uses "miscinput.wdl". The "hit.wav" from one of the template folders is also used as a placeholder for the footstep sounds. Make sure it is in your project folder or in your path somewhere. This is somewhat complicated looking, but it really isn't if you understand your C-script. There's a simple player action at the end to demonstrate how to call these functions. Sorry for the minimal comments, but you shouldn't have too much trouble figuring it out. There's quite a bit of commented out code in a couple of the functions. I'm not using that, for now, but you can do whatever you want with it. I don't know if uncommenting it will break the system, though. Credit to Pappenheimer/Gnometech for the environment/calculating functions. I've modified/simplified it a bit, but the soul of their work is still there. Credit to whoever helped me on the blending/animation function. Credit to Doug for the misc input file. It's required to set up/assign controls/keys. Get the code below and read on further into this thread for usage instructions and updates/progress log: http://www.geocities.com/hainesrs/blending.ziphttp://www.geocities.com/hainesrs/blending.rar - same thing, just half the file size.
Last edited by Nadester; 08/17/06 23:12.
My User Contributions master list - my initial post links are down but scroll down page to find list to active links
|
|
|
Re: Animation frames blending, player input/physic
[Re: Orange Brat]
#64743
02/23/06 05:43
02/23/06 05:43
|
Joined: Aug 2000
Posts: 7,490
Orange Brat
OP
Senior Expert
|
OP
Senior Expert
Joined: Aug 2000
Posts: 7,490
|
Here's the DEMO. I integrated a 3rd person camera to showcase the code, since it wouldn't make any sense to use it in first person. http://www.geocities.com/hainesrs/blending.rar - 380kb OR http://www.geocities.com/hainesrs/blending.zip - 718kb The animation states blending will be obvious, so I don't need to explain it. However, the various movement/control modes need to be addressed, so you'll know how each value influences the camera and controls. The VAR "movementType" has 5 possible settings: 0, 1, 2, 3, and 4. The default is "0". To change this value, find the function named "loadControlsDefault" located in "main.wdl". Simply change the value to one of the five listed above. Here's what each one will do for you. movementType0 = This is a standard behind the player, 3rd person camera and is controlled with the mouse. The player moves relative to itself using W and S, and strafing is not yet implemented. This is most like the controls and camera used in Max Payne. 1 = This is a standard satellite style, 3rd person camera and is controlled with the mouse. The player moves relative to itself using WASD and would best be compared with the early Resident Evil play mechanics(i.e. tank controls). 2 = This is a standard satellite style, 3rd person camera and is controlled with the mouse. The player moves relative to itself using the gamepad. 3 = This is a standard satellite style, 3rd person camera and is controlled with the mouse. The player moves relative to the camera using WASD. This is most like the controls and camera used in Splinter Cell. 4 = This is a standard satellite style, 3rd person camera and is controlled with the mouse. The player moves relative to the camera using the gamepad. This is most like the controls and camera used in Splinter Cell. Please note that in gamepad mode the camera should ideally be controlled with the 2nd analog stick or some other button on the input device. However, this feature is not yet implemented, so you'll have to settle for the mouse. It isn't very practical, but I'm not going to fix it anytime soon. This is valid for movementTypes 2 and 4 only. Finally, when in modes 3 and 4 there is an animation frame problem with the "idle" and "stand" states. The way it is scripted, now, the player's state will change to its idle animation after about 8 seconds of inactivity. This works as it should with modes 0-2, but it does not function in the other two. Also, the stand state does not occur when not moving. This used to work, so I must have broke something when I was actively working on this and forgot to go back and fix it.
My User Contributions master list - my initial post links are down but scroll down page to find list to active links
|
|
|
|