Controllers

I have to clone a controller assigned to a Spatial,then assign the copy to its SharedMesh. I need to clone controllers because all the SharedMesh derived from that spatial must animate in different ways.

How can i clone a controller?



thanks :slight_smile:

oh, you are right, Llama. Sorry deus.



I just had a short look into the code and there seems to be no generic cloning or copying available currently. It could though be easily introduced again using the Savable interface, if people really need it.



To be honest I did not completely understand why you need cloning, otoh…

Well, if you write the Controllers yourself make it a Clonable or write some copy method. If you use a Controller from the core and it does not implement Cloneable you can use CloneCreator I suppose (I have not used that solely on Controllers though). If all fails simply create a new Controller and copy the properties.

CloneCreator doesn't exist anymore does it?

I'll try to explain it better (sorry for my english  ://)

I am developing a shoot'em up game,so i've to use many instances of the same enemy on screen. For this reason i use the SharedMesh to share the data and reduce memory occupation. These enemies has also animation (made with milkshape). I cannot assign the controller of the target mesh to the SharedMesh objects (lets says not in any case) because the enemy spaceships must execute a different animation based on their state. For examples i have to stop an animation,or speed it up. The best way (i think) would be to make a copy of the target mesh controller for each SharedMesh created.

If you implement a clone method for Controller, we'll commit it to CVS.

In this case, Deus, I don't think that you really need to clone/copy controllers. Simply write your enemy controller and create an instance for each of your enemies. Most likely you will have to set a few values for each enemy only. You might even want to never set the same values for two enemies . . .



btw. should your nickname mean 'god' or is this just a coincidence and it has some other meaning?

If you implement a clone method for Controller, we'll commit it to CVS.

I can take a look at the source code and see if i can do something,but my knowledge of jme is not so good at the moment...  :cry:

I understand what you mean Irrisor,but the problem is that the controllers are JointControllers (of a milkshape model) created at loading time by jme... maybe a clone method would be better in this case?  :?

btw. should your nickname mean 'god' or is this just a coincidence and it has some other meaning?

Yes,it really mean "god" (in latin) but i surely choosed it for other reason times ago that i dont remember anymore  XD

ah, well you want to have independently animated shared nodes: that's possible somehow, I read some posts about it here on the forum the last weeks - it can be done now.



Search the boards for recent posts about it - maybe even someone involved could post a hint here…

ok,thanks i ll do some search in the meanwhile.  :wink:

It was a post by kevglass (you can search using his username).