≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Smooth movement
Posted by:
(you are not logged in)
Enter the missing letter in: "Inte?national"
(you are not logged in)
Text:
[quote][b][/b] wrote: Hello ddabrahim, I don't fully know what your code is doing since it seems to have been ruined by the forum's security, so I will tell you what I did. I also noticed a problem with smooth movement, so I do this: 1. I don't put the actual movement in the "[b]on key up[/b]" and "[b]on key down[/b]" portions. I use those only to set a variable to "[b]true[/b]" or "[b]false[/b]". If the button is pressed, I put this: [code][b]ShouldCharacterMoveLeft = true;[/b][/code] If the button is released, I put this: [code][b]ShouldCharacterMoveLeft = false;[/b][/code] 2. I put my actual movement in a function called "[b]OnAnimate[/b]", like this: [code][b]engine.OnAnimate = function() { if (ShouldCharacterMoveLeft == true) { moveVect = new CL3D.Vect3d(0,0,-1); PositionOfCubeNode = cubenode.Pos; newposition = cubenode.Pos.add(moveVect); cubenode.Pos = newposition; cubenode.updateAbsolutePosition(); } }[/b][/code] If the variable called "[b]ShouldCharacterMoveLeft[/b]" is set to "[b]true[/b]", the character will move. All pieces of code inside of the "[b]OnAnimate[/b]" function will happen during every frame, so the movement will be smooth.[/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact