Building a simple randomized race with lists and functions

Hi all : This semester my class has been exploring lists with functions and utilising the random feature to create more dynamic presentations. Here is a small demo of it where a horse race is simulated. Here are things that happen.

  1. You are asked how many horses you wish to race.
  2. You are asked how long the race should be (distance in meters)
  3. Based on these 2 values X numbers of random horse objects run Y meters at Z speeds.

I would love to be able to add the feature where the user can choose the animal too but I am still figuring out how to create an object without needing to have it already exist within the cospace to be made a copy of. Please feel free to visit and remix as needed.

Cheers,

2 Likes

Hi @Shashi_Krishna, very nice project :+1::+1::+1:.
For the moment you can upload external 3d object file (obj or fbx) but whitout animation. Maybe later.
Bye, Giuseppe

Thank you @Giuseppe_Schiuma. What I meant by creating dynamic objects is user gets a choice panel of different animals and the choice will basically do a create item but by supplying the object name. I have a feeling this is possible with TypeScript or Python and not CoBlocks.

Hi @Shashi_Krishna, take a look to CoSpaces API documentation. The function getItem for example has 2 parameters (object ID or name) so I suppose that the object has to be in the scene before you call this function so (probably) you cannot call an object directly from the library. You could use the function createItem but only for primitives (ellipsoid, thorus, …).
Let me know your opinion,
Bye, Giuseppe

This helps! Thanks again @Giuseppe_Schiuma

Hi @Shashi_Krishna,

You can always hide your animals or put them where they can’t be seen.

I did something similar, which may be helpful:

Hope that helps!

Geoff

2 Likes