Search Unity

HELP!

Discussion in 'Scripting' started by klaudas19, Sep 25, 2017.

  1. klaudas19

    klaudas19

    Joined:
    Sep 24, 2017
    Posts:
    5
    I use unity 3D with c# and i made cube that jumps and moves with forward force and it can go in A and D directions
    and when it goes forward i try jumping and moving cube starts rotate Like this: upload_2017-9-25_21-13-13.png
    And i want it to be like this : upload_2017-9-25_21-14-46.png
    so when i move and jump it doesnt rotate at all
     
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,532
  3. klaudas19

    klaudas19

    Joined:
    Sep 24, 2017
    Posts:
    5
    i freaking know where to start just tell me how to fix my problem
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    There's a lot of factors that go into what happens when you apply a force to an object. You haven't really described your issue very well or included any of your code, so it is hard to speculate. Just from your images though it looks like your cube rotated around its Y axis. You can prevent that by freezing Y rotation on the rigidbody.
     
  5. klaudas19

    klaudas19

    Joined:
    Sep 24, 2017
    Posts:
    5
    I know but if i freaze y it wont jump and i want to make it jump and spin arround in air for 90 degrees
     
  6. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Freeze Y rotation, not Y position. It'll still jump, it just won't spin around Y.
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  8. johne5

    johne5

    Joined:
    Dec 4, 2011
    Posts:
    1,133
    Would changing from a RigidBody to a CharatorController help any?