Mesh creation API?

Materials, textures, lighting, postfx
5 posts Page 1 of 1
saindd
Posts: 220
Joined: Wed Apr 15, 2015 3:20 am
by saindd » Wed Aug 12, 2015 5:07 pm
Is there a mesh creation API for Torque 3D, that allows me to create meshes in code and adapt them procedurally according to parameters? I'm planning to create something like this:

https://www.youtube.com/watch?v=U96lYmanvAg
https://www.youtube.com/watch?v=F8mIgEajWGc
JeffR
Steering Committee
Steering Committee
Posts: 763
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Thu Aug 13, 2015 1:04 am
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.
saindd
Posts: 220
Joined: Wed Apr 15, 2015 3:20 am
by saindd » Thu Aug 13, 2015 8:02 pm
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.
buckmaster
Steering Committee
Steering Committee
Posts: 321
Joined: Thu Feb 05, 2015 1:02 am
by buckmaster » Fri Aug 14, 2015 2:24 am
I don't think you're likely to kill memory unless you have like 500 people doing this at the same time, or your mesh files are huge. What do you mean by removing it soon after the mouse moves?
JeffR
Steering Committee
Steering Committee
Posts: 763
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Fri Aug 14, 2015 6:17 am
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.
5 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest