x


Procedural Object creation + Animation (language 'any') + video link

How would I proceduraly duplicate an existing object in the scene and apply procedural animation to it using just math. I would like for this to be done in c# if possible. but if its easier or someone has a solution for it in another language I'm completely open to it.

If anyone is able to supply a solution feel free to make it super simple.

I have a sphere in the scene and I want to proceduraly duplicate and apply animation to that referenced sphere. The animation itself would be moving the sphere from a random starting point within a 10x10 grid, to its ending point which would be 10 units up(Z-axis) over the course of a half a second. I really hope this is a possible think and that guys can help me out.

example = http://www.youtube.com/watch?v=-CTmD5vrHSg&feature=youtu.be

Thanks John

more ▼

asked Jul 18 '12 at 06:33 PM

JokerMartini gravatar image

JokerMartini
15 4 9 11

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

It is very easy to copy any object. Use UnityEngine.Object.Instantiate

You can also procedurally move things around very easily in unity: "GameObject.transform.position = someVector3;" You can change "someVector3" per frame and make it follow any sort of math you want. Unity's Coroutines make functions execute over a time in a way you can procedurally control, I'd say give them a try, it'll give you a good idea how to do this.

more ▼

answered Jul 18 '12 at 07:27 PM

Mortoc gravatar image

Mortoc
915 2 6 14

How do I specify where these objects are to be created. Can I somehow place spawn points in the scene and use those as the points in which the spheres will be instanced to as their starting positions?

Jul 18 '12 at 08:15 PM JokerMartini

Yes, you can do that. If you follow the getting started with Unity tutorials, by the time you're done, you'll have no problem doing this sort of thing.

http://docs.unity3d.com/Documentation/Images/manual/ScriptingTutorial.pdf

Jul 18 '12 at 08:21 PM Mortoc

Would you be able to help me mock up just a quick sample of how this is written. I'm new to unity and this is my first build of any kind so any examples would be greatly appreciated. I understand what I'm after but I'm not quite sure how to write these things. The more examples I see the more I'll be able to take it from there and go crazy. I'm familiar with the concept of scripting as I've done my fair share in 3d applications like 3ds Max and Maya, but not unity.

These are the steps I'd like to see how would be written together and from there just explain how a fresh new scene would be setup. I created a sphere and a new js script but I'm not sure where to place the script, and does the object being duplicated have to be in the scene or just in the project?

Steps: 1. Using Instantiate to duplicate a GameObject 2. Give the new instanced object a unique name 3. Using an array of predefined locations in 3d space place the newly duplicated object. (these locations could be defined by using spawn points? if possible) 4. Apply a simple procedural animation to the object over the course of 10 frames.

Jul 18 '12 at 08:37 PM JokerMartini

Where is the location of that tutorial. I was going to see if there were more scripting ones in that same level of detail. It definitely helped make sense of some stuff.

Jul 18 '12 at 09:32 PM JokerMartini

AWESOME! Great news. So from the linked pdf I've been able to do steps 1 & 3. Now I'm trying to figure out how to apply a procedural animation to the objects. I do not have to bother doing the unique name since I'm just instantiate a prefab....correct?

Thanks again for you help. It's been super helpful.

Jul 19 '12 at 12:24 AM JokerMartini
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3768
x321
x3

asked: Jul 18 '12 at 06:33 PM

Seen: 361 times

Last Updated: Jul 19 '12 at 12:24 AM