playMaker

Author Topic: set radom vector direction and add force  (Read 104 times)

koala

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
set radom vector direction and add force
« on: April 30, 2020, 03:21:10 AM »
Hello, I am trying to make a sphere move in a random direction.
In the first state I do the following:
- I create two random float variables. one for the x direction and one for the y direction, with values between -1 and 1
- I create another float variable with the speed at 200,
- I create another variable vector 3 called ball vector that takes the random values of x and y

In the second state I do the following:
- I add the action add force
- to the parameter vector I give the value ball vector
- to the parameter x I give the value of the speed
- to the parameter and I give the value of the speed

doing this, the sphere always moves in the same direction and not randomly.

what am I doing wrong?
can you help me please
thank you very much to all!
« Last Edit: April 30, 2020, 04:27:42 AM by koala »

ch1ky3n

  • Full Member
  • ***
  • Posts: 117
    • View Profile
Re: set radom vector direction and add force
« Reply #1 on: May 01, 2020, 06:32:23 AM »
instead of randomizing it at first, try to manually assign a value on it and check if it could change the direction

assign bigger value and see if it is actually moving in a different direction.