Jump to content

Is there a way to replace geometry of a mesh with another?


Hazardus
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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... then

newMesh.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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...