Jump to content

How to give control to an object?


photo

Recommended Posts

I did the controls for this course ( https://developer.unigine.com/ru/docs/latest/start/quick_start/character/index?rlang=cpp&autotranslate=ru), but I couldn't give the controls to the usual ones like in WASD games, but I managed to turn it with the mouse. I assigned the control file as in the course, I couldn't just switch to ObjectMeshSkinned. At the start of the game, the tank rotates 360 degrees with the mouse, although it should move normally. I assigned the keys as in the course, but maybe I messed up with the files, although I did everything according to the instructions (which I got on the screenshot 3,4,5)
I will be very grateful for your help!

11.png

22.png

44.png

44.png

55.png

Link to comment

Hi Reshaaa!

If I understand correctly, you use the ObjectMeshStatic named default instead of the robot model from the instructions. Please ensure that you have properly assigned the PlayerController property to it:

  1. Select your ObjectMeshStatic node in the World Nodes window.
  2. Click Add New Property in the Parameters window.
  3. Assign the PlayerController property.
  4. Save changes to the world.

Based on the provided screenshots with the source code, the controls should work correctly:

  • The model with the PlayerController property should rotate to face the mouse cursor (as it defines the movement direction). Please note that clicking the mouse buttons doesn’t affect the movement in the forward-backward or left-right direction.
  • The model should move if you press any of the W, A, S, or D keys.

Feel free to ask any questions!

Link to comment
×
×
  • Create New...