-
Posts
76 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by psychoanima
-
-
Honestly, I do not think that has been fully implemented as I never saw any difference in behavior from a max rotation speed between 5000 or 0.0005. What you can do is control how fast the angle value is changed to the final amount.
example:
angle = player:GetRotation(true).y --defined before main loop
move = 0
strafe = 0
jump = 0
crouch = false
maxaccel = 1
maxdecel = 0.5
detailed = false
maxrotationspeed = 0.5
..
..
--Main Loop
p_rot = player:GetRotation(true)
if window:KeyHit(Key.Right) then angle = 270 end
if window:KeyHit(Key.Left) then angle = 90 end
finalangle = Math:CurveAngle(angle, p_rot.y, 10) --decrease step to quicken rotation
player:SetInput(finalangle,move,strafe,jump,crouch,maxaccel,maxdecel,detailed,maxrotationspeed)
That's really cool idea for rotation, thanks!
Do you think it can be easily implemented with the script bellow:
(I am using the same logic like in function Script:UpdatePhysics() )
-
Or most likely I misunderstood this parameter. What is actually rotating, some example maybe?
-
I don't know how to set maxrotationspeed for SetInput and to avoid ultra fast body turn. I read in API reference that maxrotationspeed is in degrees per physics step, but I still don't understand which number is giving slower rotation?
-
if window:KeyDown(Key.C) then
self:Run()
else
self:Idle()
end
That makes it more clean, tnx!
AnimationManager.lua is in Scripts folder in FPS project template. See how it's used for crawler animation.
I will investigate, thank you!
-
I'd also recommend using the AnimationManager lua class that Josh has provided. It's just a nice utility class to deal with animation/blending/complete callback.
I am using Josh 2D platformer script example, but I have to reshape a lot of things cuz not everything is working how I wanted. I am not sure how to find AnimationManager lua class, I am rookie here, sry
BTW SetInput function is a time saver for sidescroller moving!
-
I found the answer for one part of my question.
I forgot to mention that for running animation I was using Time:GetCurrent() in SetAnimationFrame, that's why I get unwanted cycling animation.
My code is now like this:
local isrunning = 1 function Script:Draw() if window:KeyDown(Key.C) then isrunning = isrunning +1 self.entity:SetAnimationFrame(isrunning,1,1) end
now I need to figure out how to add Idle when no key is pressed and how to blend it properly.
-
I have 3 .fbx animation, one is for running, second is idle, third jumping. (2.5d platformer)
To trigger running I am using
if window:KeyDown(Key.D) then self.entity:SetAnimationFrame() end
Problem:
how to trigger idle animation since there is no Key release function? And how to blend it with previous animation?
Second problem:
I notice this when I am using KeyDown function: When I am pressing key to start the animation, releasing the key stops animation in the viewer, but animation is still looping somewhere in the background. I noticed that when I do quick press/release button on my keyboard - animation is cycling instead of starting from beginning.
-
ooooh, I get it. It's lua function... I found an explanation. Sry for this stupid question (I suck in Lua, need to fix that)
- 1
-
I am analyzing some scripts and I found math.abs but I can't find explanation in API reference. Help?
Entity::SetInput, maxrotationspeed
in Programming
Posted
Math:CurveAngle() works perfect for my rotation need.
Now I have another problem. My character is moving on X and Z axis but needs to stay locked on Z and to move only on X.
I read in one post this method for locking:
(in function Script:Start())
&
( in function Script:UpdateWorld())
but nothing is changing in the viewer, it's still floating on Z