playMaker

Author Topic: place object in a volume?  (Read 1244 times)

peaks

  • Playmaker Newbie
  • *
  • Posts: 27
place object in a volume?
« on: June 26, 2016, 08:24:12 AM »
Hej everyone!

I'm trying to create a random position mechanic for my game. I have a pickup item which should "spawn" at random position of a volume.

spawning randomly isn't my problem, I can simply use random vector3 and type in as may position vectors as I want, but I want it somehow more dynamic :D

My goal would be something like this: I have a cube 3x3x3 units in my scene and the pickup should be spawn inside this cube-volume at random positions (like f.ex. spawn at position 3x2x3).


 
Is there any way to achieve this?

avagantamo

  • Playmaker Newbie
  • *
  • Posts: 2
Re: place object in a volume?
« Reply #1 on: June 26, 2016, 09:30:34 AM »
Use the random float action for each axis and set the min to 0 and max to 3. it will then return a random float in that range.