Search Unity

PLS SEND HELP! Having some trouble on rotating an object

Discussion in 'Visual Scripting' started by ryaaanchuaaa, Aug 31, 2020.

  1. ryaaanchuaaa

    ryaaanchuaaa

    Joined:
    Aug 29, 2020
    Posts:
    2
    so im using this button to control a cylinder to rotate 90degrees on every click
    the problem is when i click on the button, the cylinder just jumps from 0 to 90,not showing the movements in between
    can someone tell me what im doing wrong here or what i should add to make the rotation movement visible, but not just jumping from 0 to 90?

    btw the pic i uploaded is not accurate, the yAngle is already set to 90
    and i have 0 knowledge in coding or scripting
     
  2. ryaaanchuaaa

    ryaaanchuaaa

    Joined:
    Aug 29, 2020
    Posts:
    2
  3. Siro13

    Siro13

    Joined:
    Jun 30, 2014
    Posts:
    33
    You can Lerp from 0 to 90 in some time.

    This is how I lerp Velocity from 5 (MoveSpeed) to 2 in 1sec:

    upload_2020-9-1_23-57-1.png


    I need also:

    upload_2020-9-1_23-58-28.png

    It is necessary to reset the timeElasped variable when I enter into State Walking.
    I use the State Graph, but you can adapt the nodes to the Flow Machine

    And this is where I increment the timeElasped:

    upload_2020-9-2_0-1-38.png


    I use FixedUpdate() because I use RigidBody.MovePosition but You can use normal Update()
     
  4. unity_Nx7PMLMgq9zu9Q

    unity_Nx7PMLMgq9zu9Q

    Joined:
    Mar 31, 2021
    Posts:
    5
    While key hold move by say 10 degz