Hazardus Posted October 20, 2015 Share Posted October 20, 2015 I have several primitives in my scene as *placeholder meshes*. These meshes have actions (and subsequent animations) attached to them. What I would like to do is to simply replace a placeholder mesh with the real mesh, while maintaining properties like actions, position, etc. What would be the most simple way to accomplish this? Quote Link to comment Share on other sites More sharing options...
reddozen Posted October 20, 2015 Share Posted October 20, 2015 Animations and locations etc are easy Animation / skeleton:newMesh.skeleton = placeHolder.skeleton; Will this work without doing x, y, z specificially?newMesh.position = placeHolder.position; If not... thennewMesh.position.(x,y,z) = placeHolder.position.(x,y,z); same for rotation and scale as position... Don't know much about actions. haven't had to mess with them yet. Quote Link to comment Share on other sites More sharing options...
Hazardus Posted October 21, 2015 Author Share Posted October 21, 2015 Actions/their animations are the main thing I'm having trouble with, but I'd like to be able to cleanly transfer everything except the vertices to my new mesh before calling .dispose() on the original. I actually wrote a function that copies all the properties in the object until it gets to .constructor, because that stuff is added automatically via prototype extension. I guess I'll have to re-register the actions on the new mesh? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 21, 2015 Share Posted October 21, 2015 If you copy the actionManager from source mesh to new mesh this should be good Hazardus 1 Quote Link to comment Share on other sites More sharing options...
Hazardus Posted October 21, 2015 Author Share Posted October 21, 2015 If you copy the actionManager from source mesh to new mesh this should be good Right you are, dunno why I didn't think of that. Are there any properties I should exclude from copying to the new mesh besides : [ uniqueId, geometry, _boundingInfo, subMeshes ] ? It seems to be working fine so long as I exclude those 4 (and the inherited prototype properties as mentioned above). Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 21, 2015 Share Posted October 21, 2015 generally speaking, do not copy _something. Geometry and submeshes as well I think you found everything actually Quote Link to comment Share on other sites More sharing options...
Hazardus Posted October 21, 2015 Author Share Posted October 21, 2015 Nice. I started to do a blanket exclude on private properties, but I have a few of my own baked in. Lovin' your software bro! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 21, 2015 Share Posted October 21, 2015 I appreciate Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.