Jump to content

Beginner - Convert a mesh


degac
 Share

Recommended Posts

Ok, after some tests I decided to post to ask help!

 

I have made a little sphere with DeleD, exported as .obj file.

I converted it with the tool obj2gmf.exe and I got my .gmf sphere loaded in my program. Everything is ok

 

Now I want to make 'active' its own physic body - I really dont' understand if obj2gmf creates or not the physic body (from my test - with DebugPhysics(True) it is 'red', but present).

 

I replaced my 'sphere.gmf' with 'oildrum.gmf' and everything works as expected.

What I miss?

I need to use some other tools?

 

'Use the Leadwerks Engine module as our base
Framework leadwerks.engine
'Create an OpenGL graphics window 
Graphics 800, 600
'Allows the engine to find files and load files from zip packages 
RegisterAbstractPath AppDir
'Create a world 
If Not CreateWorld() RuntimeError "Failed to create world."
'Create a camera 
cam:TCamera = CreateCamera()
CameraClearColor(cam, Vec4(0, 0, 1, 1))
MoveEntity cam, Vec3(0, 0, - 5)

'create a ligt
light:TLight = CreateDirectionalLight()
RotateEntity(light, Vec3(65, 45, 0))
'Create a render Buffer
buffer:TBuffer = CreateBuffer(800, 600, BUFFER_COLOR | BUFFER_DEPTH | BUFFER_NORMAL)

body:TBody = CreateBodyBox()
SetBodyMass(body, 1)
mesh:TMesh = CreateCube()
EntityParent(mesh, body)
PositionEntity(body, Vec3(0, 2, 0))

body2:TBody = CreateBodyBox()
SetBodyMass(body2, 1)
mesh:TMesh = CreateCube()
EntityParent (mesh, body2)
PositionEntity(body2, Vec3(0.5, 5, 0))
DebugPhysics(True)

ground:TBody = CreateBodyBox(10, 0.1, 10)
groundmesh:TMesh = CreateCube()
ScaleEntity(groundmesh, Vec3(10, 0.1, 10))
EntityParent(groundmesh, ground)
PositionEntity (ground, Vec3(0, - 1, 0))

Local ball:tmodel=LoadModel("abstract::sphere.gmf")'oildrum.gmf")
PositionEntity ball,vec3(.5,2,0)
'ScaleEntity ball,vec3(0.1,.1,.1) '--> too big?
EntityType ball, 1
SetBodyMass ball, 12

Collisions(1, 1, 1)
EntityType(body, 1)
EntityType(body2, 1)
EntityType(ground, 1)

'Main loop 
While Not KeyHit(KEY_ESCAPE) 
'Update timing, physics, and other miscellaneous updates 
UpdateWorld
'Draw the world 
SetBuffer(buffer)
RenderWorld
'render lighting
SetBuffer(BackBuffer())
RenderLights(buffer)
'Swap the graphics buffers so we can see what we drew 
Flip
Wend

 

Thank you

Cheers

Phenom II X4 955 Asus HD5770 4GB Ram WindowsXP Sp2 BlitzMax

www.graphio.net www.graphioware.com

Link to comment
Share on other sites

Hi degac,

Generally you make a .phy to go with your object. There is a .phy generator in the SDK /Tools folder called phygen. There are other tools around too including one for 3dsMax.

AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64.

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.

 Share

×
×
  • Create New...