c# - Adding Torque To Character With FixedAngle 2D -
i've been stuck on lastly few days i'm hoping guys can help.
i'm making 2d game , want character slip, fall backwards, , nail head when tries run on water ice long. goal have if maintain holding run button long plenty on ice, slip backwards , harm himself. i'm using playmaker know little c# programming.
the first thing tried making animated float adds rotation z axis on time, went horribly wrong , makes character jump/skip/glitch on place.
the sec thing thought of add together 2d torque create him start slipping backwards, stays in same rotation fixedangle true.
so made fixedangle false when on ice, falls forwards or backwards start running. made center of mass right in middle stands fine long not moving.
does know way of achieving effect want? first game , noob, there easier/correct way of going this. doing wrong, guide in right direction appreciated.
it seems verbage, want tracking amount of time player has been running on ice.
if want tie run key beingness down, start timer if button downwards , trigger "slip-and-fall" event occur after amount of time.
if want tie amount of time player has been on ice, start timer when player reaches water ice , trigger "slip-and-fall" event occur after amount of time.
if want there visual tilting, tie time delta angle of object. set angle trigger "slip-and-fall" event.
update(){ if(this.running && _terrainatpos == <ice> && isgrounded){ transform.rotate(0,0,3*time.deltatime); if(tranform.rotation.z > 180){ //do falling event } } }
edit: above not working sample. whipped illustrate.
c# unity3d 2d game-physics
No comments:
Post a Comment