Issue With Move Node And Gravity

Discussion in 'BBNodes' started by PunkPuffin, Apr 23, 2019.

  1. PunkPuffin

    PunkPuffin Avid Boxer

    Joined:
    Sep 27, 2018
    Messages:
    206
    Likes Received:
    131
    I believe there is a an issue with the Move Node when Physics is enabled on the Asset.

    If you enable physics on your asset and apply a Move node and set your asset to move say in the -Z direction with for example 0,0,-5 for the speed you will notice that gravity no longer works.

    I believe this bit of code

    Code:
                let vel = phys.linearVelocity();
                vel.x = speed.x != null ? speed.x : vel.x;
                vel.y = speed.y != null ? speed.y : vel.y;
                vel.z = speed.z != null ? speed.z : vel.z;
    Should read like this.

    Code:
    let vel = phys.linearVelocity();
                vel.x = speed.x != 0 ? speed.x : vel.x;
                vel.y = speed.y != 0 ? speed.y : vel.y;
                vel.z = speed.z != 0 ? speed.z : vel.z;
    Once you do this gravity works again.
     
  2. Thud

    Thud Boxer

    Joined:
    Apr 9, 2019
    Messages:
    9
    Likes Received:
    4
    Thank you so much for posting this. I was so confused why it worked before and it didn't now. I have been racking my brain. I thought maybe I did something to jack up the code. Again, thank you. -Shawn

     
  3. PunkPuffin

    PunkPuffin Avid Boxer

    Joined:
    Sep 27, 2018
    Messages:
    206
    Likes Received:
    131
    No problem. Glad it helped you out

    Have a look at some of the nodes I’ve posted you might be interested in those too
     
    itzonator likes this.
  4. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,182
    Likes Received:
    497
    Thanks for this. I was pulling hair out why gravity just stopped working once physics were enabled.
     
    PunkPuffin likes this.
  5. Hamish

    Hamish Boxer

    Joined:
    Apr 1, 2018
    Messages:
    1
    Likes Received:
    1
    I also want to add my thanks! Had the same problem, made the same change to the code and it now works, thank you!
     
    PunkPuffin likes this.
  6. Thud

    Thud Boxer

    Joined:
    Apr 9, 2019
    Messages:
    9
    Likes Received:
    4
    I thought this would be fixed in the final release. Why does it still happen by default? Does anyone else experience this?
     
  7. PunkPuffin

    PunkPuffin Avid Boxer

    Joined:
    Sep 27, 2018
    Messages:
    206
    Likes Received:
    131
    Yup. It wasn’t fixed
     

Share This Page