Announcement

Collapse
No announcement yet.

Disabling and enabling player movement and rotation on button press

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Disabling and enabling player movement and rotation on button press

    Hello,

    I am trying to create an in-game model viewer. Right now I have the ability to click on a Physics Object and have it appear in front of the character and when Spacebar is pressed, the object goes back to its original position and rotation. The problem I'm having is that the player can still move around with the object in front of them.

    What is the best way to disable player movement and rotation while the object is in front of them?

    I would like the end result to be:

    On left click -> object shows up in front of the player -> disables player movement and rotation -> enables object rotation via mouse
    On Spacebar -> object returns to original position -> enables player movement and rotation -> disables object rotation

    Any help would be greatly appreciated! Thanks

    #2
    if you have 'add movement input' node in your BP or something similar, add branch node in front of that node with condition like 'Is_previewing?' and connect false to 'add movement input'. Upon pressing spacebar, set 'Is_previewing? to true, so branch will not allow model to move. not sure if it is clear enough, can't get to my pc at the moment.

    Comment


      #3
      Thanks, that's exactly what I needed! I ended up setting a Branch node right after all movement functions (keyboard and mouse). The Branch node required the "Stop movement" bool to be false. When left clicking on an object it sets Stop Movement to true, and when pressing Spacebar it sets Stop Movement back to false. Worked perfectly!

      Comment

      Working...
      X