Ask a Question related to Macromedia Director 3D, Design and Development.
-
JustStupid #1
havok collision detection problem
Hello everyone,
Been posting a few problems recently some of which I found my answers myself
after a bit more thinking. So promise this will be last one for a while anyway!
:tounge;
I'm using havok via importing the havok physics scene into the cast [non hke]
and trying to add collision detection to my complex model (a castle!) and well
its not really doing anything my characters can still walk through the walls,
but there are no errors as well so I can't see where I'm going wrong :rose;
Heres the code I have.
on beginSprite me
myHk = member("havok")
myMember= sprite(me.spritenum).member
myTolerance = 4.0 -- usualy only 10% of worldscale
myWorldScale = 1 -- inches (1 inch = 0.0254 metres [use 1.0 if world is
designed using Metres]
myGravity = vector(0, -9.81, 0) -- for 1.0 metre scale, use vector(0, -9.81,
0)
myHk.initialize( myMember, myTolerance, myWorldScale ) -- set it up
myHk.gravity =myGravity
-- used by the step() function in the exitframe
myTimeStep = 0.04 -- 1/25.0 i.e. 25 fps
mySubSteps = 5 -- used by havok to calculate between time steps
mlist = ["castle","water", "knight", "whiteknight"] --this is a list of
model-numbers I want to apply physics to
player = myMember.model("knight")
player.addModifier(#meshDeform)
prb = myHk.makeMovableRigidBody("knight",100,true,#box)
player2 = myMember.model("whiteknight")
player2.addModifier(#meshDeform)
prb2 = myHk.makeMovableRigidBody("whiteknight",100,true,# box)
m = myMember.model("castle")
m.addModifier(#meshDeform)
myHk.makeFixedRigidBody(m.name,false)
m = myMember.model("water")
m.addModifier(#meshDeform)
myHk.makeFixedRigidBody(m.name,false)
end
on exitFrame me
myHk.step( myTimeStep, mySubSteps ) -- advance the simulation
--Down
if keyPressed(125) then
player.translate(0,-5,0)
end if
--up
if keyPressed(126) then
player.translate(0,5,0)
end if
--left
if keyPressed(123) then
player.rotate(0,0,5)
end if
--right
if keyPressed(124) then
player.rotate(0,0,-5)
end if
end
on endSprite me
myHk.shutdown() -- Tidy up, i.e. remove it from memory
end
Any ideas of what could be going wrong? Can havok be applied to complex
models?
Cheers in advance for any suggestions!
Brenden
:wink;
JustStupid Guest
-
collision detection in havok?
Is there any ways to detect two movable regid bodies collide or not? -
Cinema 4d > w3d collision detection problem
When i export my 3d scene in Cinema 4d everything goes fine. But when I import the scene in director and add my Collision detection script, I can... -
Problem with #Collision Modifier detection
Hi all Please help me. Using #collision modifier, I cant detect collision with an editable spline model imported from dwg (Autocad) to... -
Havok Collision Detection
For my project I need to detect multiple collisions on one object. To do this I have been attempting to use various bounding boxes and using a... -
Collision detection Problem
hai, I am using modelsUnderRay method to check my collision which has been described in the tutorial in the link below.... ... -
hondo3000 #2
Re: havok collision detection problem
>I found my answers myself after a bit more thinking
thats a very clever move!!!
but the problem is not the set up of the scene, it's your navigation. If you
want to move a Object in the havok world, you have to do this with forces.
i did some time ago this little demo to make a very simple navigation with
havok.
[url]http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=268&threadid=[/url]
1082944&highlight_key=y&keyword1=havok
the code has a lot of comments, if you have more questions just ask.
regards!
hondo3000 Guest
-
JustStupid #3
Re: havok collision detection problem
Thanks I will check it out! :wink;
JustStupid Guest



Reply With Quote

