[Closed]Spawning object in random range on x-axis

Spawning an object on x-axis with random range.
I get the spawning part working but I can’t implement random spawning on x-axis.

Get direction with getTransform > getVectorFromTransform (choose lookAt or Right vector)
Multiply direction by a random number, add that to spawning origin.

I am sorry, I said misunderstanding statement.I was trying to say that kha.math.random doesnt work with vectors.
I am trying to make something like this-> spawnObject(“ObjectName”, null, spawnobjectloc);
where spawnobjectloc is a function containing it loc in x,y,z and in x i am trying to assign random value between -2 and 2. I am using something like randomIn(-2,2) for random.But it show Fast float or some error.But I get it working on nodes.

Open an issue on Github.

why not to compose a vector by random floats and multiply or add it to the origins you want ?

i did that in nodes. by the way it is closed. But thanks for response.:grinning:

oh ! ok I didnt notice if it was closed or not. Nice !

1 Like