Please, need help

Hello, dear people of this forum.

Sorry for bad English, because I still do not know your language, I communicate with you through an interpreter. (Thanks for understanding)

I am still very bad sort and Panda3d and python, and I very much need your help.

I have to ask you, could you show the code with a working physicist. Ie a box falls ае a plane (the ground).

Thanks in advance for help :slight_smile:

panda3d.org/manual/index.php/C … n_with_ODE

Of course thanks to you, dear, but before opening the topic, I looked through all the manuals, which you gave me links. I would like to consider the standard physics + collision (not ode), and to see a small, fully working code, preferably with the comments that I finally grasped how to operate the standard physics.
Thanks

I very much suggest you using ODE for everything that goes further than zone triggers.

It may sound easier to use built-in physics, but we (a buddy and me) had a hard time understanding Panda’s ideas behind the ActorNode and the way Panda handles physics in general.
That said ODE was really quite intuitive and simple to use. (Though I must admit, I haven’t used ODE for collisions yet, only for physical calculations.)

Long story short: try out ODE.
I doubt you’ll regret that choice.

:smiley:

Thank you persuaded me, but I have a new problem.
I wrote the code, based on the code this in the manual, the code runs without error, but runtime error ,, help please, can I do something wrong? Thank you for your attention and help!

from direct.directbase import DirectStart
from pandac.PandaModules import OdeWorld, OdeSimpleSpace, OdeJointGroup
from pandac.PandaModules import OdeBody, OdeMass, OdeTriMeshData, OdeTriMeshGeom
from pandac.PandaModules import BitMask32, CardMaker, Vec4, Quat
from random import randint, random
 
# Setup our physics world
world = OdeWorld()
world.setGravity(0, 0, -9.81)
 
# The surface table is needed for autoCollide
world.initSurfaceTable(1)
world.setSurfaceEntry(0, 0, 900, 0.0, 9.1, 0.9, 0.00001, 0.0, 0.002)
 
# Create a space and add a contactgroup to it to add the contact joints
space = OdeSimpleSpace()
space.setAutoCollideWorld(world)
contactgroup = OdeJointGroup()
space.setAutoCollideJointGroup(contactgroup)

do = loader.loadModel("do")
do.reparentTo(render)
do.setPos(0,0,20)

land = loader.loadModel("land")
land.reparentTo(render)

doBody = OdeBody(world)
M = OdeMass()
M.setSphere(30,10)
doBody.setMass(M)
doBody.setPosition(do.getPos(render))
doBody.setQuaternion(do.getQuat(render))

doTrimesh = OdeTriMeshData(do, True)
doCol = OdeTriMeshGeom(space, doTrimesh)
doCol.setBody(doBody)

landTrimesh = OdeTriMeshData(land, True)
landCol = OdeTriMeshGeom(space, landTrimesh)


# Set the camera position


def simTask(task):
	space.autoCollide()
	world.quickStep(globalClock.getDt())
	do.setPosQuat(render, doBody.getPosition(), Quat(doBody.getQuaternion()))
	contactgroup.empty() # Clear the contact joints
  	return task.cont

taskMgr.doMethodLater(0.5, simTask, "Physics Simulation")

 
run()

Excuse me for getting off topic, but based on the image hosting site you used, I guessed you know russian so you might have a look at the russian forums: panda3d.org.ru/
panda3d.org.ru/forum/