How to change vertices in a mesh

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

How to change vertices in a mesh // Interactive Artwork

1  |  

Post by Hans // May 19, 2007, 4:07am

Hans
Total Posts: 13
I want to write a script that starts with making a copy of a certain cube, then change its position and rotation according to numbers in a file and also change the vertices to values from world coordinates given in the file. Then this will be repeated with another copy a. s. o. until end of file.

Is there anyone who can give me some hints on how to do this? The first problem I hit is to find out how to get at the vertices of a mesh with tS7.5 scripting. The second is how to recalculate world coordinates to mesh coordinates. The third is how to read from a file with Jscript.

(I am a total newbie to tS scripting apart from a little Python, but am rather experienced i Smalltalk programming, and somewhat in VisualBasic6.)

Post by Jack Edwards // May 19, 2007, 6:04am

Jack Edwards
Total Posts: 4062
pic
You may want to download my morpher script object, that should have a lot of the answers you need:

http://forums1.caligari.com/truespace/showthread.php?t=2573


I haven't had a chance to update it for 7.5 yet, but it worked fine during beta testing so I'm should still work.


-Jack.

Post by Hans // May 20, 2007, 9:08am

Hans
Total Posts: 13
Thanks Jack!

Post by Jack Edwards // May 20, 2007, 2:03pm

Jack Edwards
Total Posts: 4062
pic
Welcome! Definitely let me know if you need any help. Professor Khaos wrote the code I based it on, so he's another good forum member to ask.


-Jack.

Post by ProfessorKhaos // May 24, 2007, 4:09am

ProfessorKhaos
Total Posts: 622
pic
Don't downplay yourself too much Jack. You've done a great thing here with much of it being your own work :)


One thing I'll have to look into myself a bit more too might be normals manipulation. I just realized the other day that changing vertex locations in theory changes normals orientations too. There may be a way to interpolate normals as well though it won't be quite the same as linear interpolation as is the case with vertices.


P.K. (aka Nightflight)

Post by Jack Edwards // May 25, 2007, 3:13am

Jack Edwards
Total Posts: 4062
pic
Doh, I forgot all about the normals! :o Looks like there's still work to do on the morpher script....


-Jack.

Post by Hans // May 30, 2007, 7:00am

Hans
Total Posts: 13
In the tSMorpher script I find this:

BaseMeshVerts = BaseMesh.GetVerticesStreamByName('Vertex Stream Data');

But I can not find any documentation about GetVerticesStreamByName, but GetVerticesStream()
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2020. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn