Jeff Quan wrote:
>> Date: Sat, 30 Jun 2007 01:12:10 -0700
>> From: Fargo Holiday <fargo at rpgportland dot com>
>>
>> Onward! So, I decided to try my hand and doing this to a model loaded
>> from a 3dmf. Model is loaded, all seems fine, and I have a button with
>> this in it-
>> dim myV As new VectorList
>> dim v3d As new Vector3D
>>
>> myV = tobj3d.Trimesh(0).VertexPositions
>>
>> v3d = myV.GetVector(0)
>> v3d.Y = v3d.Y + 20
>> myV.SetVector(0, v3d)
>>
>> Rb3DSpace1.Update
>>
>> And, for reasons that escape me, when I click the button I receive and
>> outofbounds exception, seemingly from v3d = myV.GetVector(0).
>>
>
>
> Out of curiosity, are you trying to manipulate a 3DMF loaded into an
> Object3D or a Trimesh?
>
> It would seem that myV isn't being set at all. However, if you remove
> the myV and just access things directly:
>
> v3d = tobj3d.Trimesh(0).VertexPositions.GetVector(0)
>
> v3d will now store the correct value. Not as efficient as what you
> have if you're accessing more than one VertexPosition, but it works.
>
> However, you cannot use SetVector if tobj3d is an Object3D -- nothing
> will happen.
> SetVector only works when your 3DMF is copied into a Trimesh.
> I use the function below to copy a single Object3D.Trimesh(n) into a
> Trimesh.
>
> Dim mesh As Trimesh
> mesh = CopyTrimesh(tobj3d.Trimesh(0))
>
>
> Function CopyTrimesh(tm As Trimesh) As Trimesh
> Dim out As New Trimesh
>
> out.VertexCount = tm.VertexCount
> out.VertexPositions.Copy tm.VertexPositions
> if tm.HasVertexNormals then
> out.HasVertexNormals = True
> out.VertexNormals.Copy tm.VertexNormals
> end if
> if tm.HasVertexUVs then
> out.HasVertexUVs = True
> out.VertexUVs.Copy tm.VertexUVs
> end if
> if tm.HasVertexColors then
> out.HasVertexColors = True
> out.VertexColors.Copy tm.VertexColors
> end if
>
> out.TriangleCount = tm.TriangleCount
> out.Triangles.Copy tm.Triangles
>
> Dim p As Picture
> if tm.Material <> nil then
> p = tm.Material.Texture
> out.Material.Texture = p
> if tm.Material.HasDiffuseColor then out.Material.HasDiffuseColor
> = True
> end if
>
> return out
>
> Once you have your Trimesh, you can now SetVector to your heart's
> desire.
>
>
> ==
> Jeff Quan
> jquan at mindspring dot com
> http://www.jcquan.com/JQportfolio
>
>
> ______________________________________________
Aha! Thanks a bunch, you were exactly correct in assessing that I was
using an Object3d. Thanks for the function too, that'll be quite handy.
Off topic- I used to work for Mindspring, in the tech support area.
Frankly, I'm amazed whenever I still see an address from there.
Thanks again,
Fargo
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|