Jump to content

Mesh creation API?


Recommended Posts

You can easily create static meshes in code.

just simply doing


%newStatic = new TSStatic()
   shapeFile = "modelfile.dae";
   position = %raycastPos;


That'll create it.

You'd need to do a raycast from the eye to get the position that the user is looking at, and then decide how you want to store those created objects, but the basics of the concept are actually very easy.

Link to comment
Share on other sites

That's nice, thanks! In order to display the transparent version of the mesh, should i just apply a different material and, if the user clicks, apply another? Also, how can i efficiently do this without killing memory? I intend to spawn the TSStatic at the raycastPos and remove it soon after the mouse moves and just not remove it once the player clicks.

Link to comment
Share on other sites

If you mean like in the UE4 vid, where it wouldn't display the 'holographic' version unless you were looking at a valid snap point?

You could spawn the mesh, and then use a schedule or tickable object to do an update check for what you're looking at.

If you're looking at a valid location, you move the static + see through material into place.

If you're not looking at a valid location, just set it to hidden.

Likely the best way to do it is have a player have a static mesh stored to them, and just swap out the mesh displayed for your holographic/previs view.

When they actually place the mesh, just spawn a new one into the level as normal. That'd probably be a bit easier of a workflow.

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.

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.

  • Create New...