Revision: 789
http://python-ogre.svn.sourceforge.net/python-ogre/?rev=789&view=rev
Author: andy_miller
Date: 2008-11-10 17:16:49 +0000 (Mon, 10 Nov 2008)
Log Message:
-----------
Updates to Ogrenewt deoms fro the 1.6.0 release
Modified Paths:
--------------
trunk/python-ogre/demos/OgreNewt/Demo05_SimpleVehicle.py
trunk/python-ogre/demos/OgreNewt/Demo07_CustomJoints.py
trunk/python-ogre/demos/OgreNewt/Demo08_Ragdoll.py
trunk/python-ogre/demos/OgreNewt/MyCustomBallSocket.py
trunk/python-ogre/demos/OgreNewt/SimpleVehicle.py
trunk/python-ogre/demos/OgreNewt/ragdoll.py
Modified: trunk/python-ogre/demos/OgreNewt/Demo05_SimpleVehicle.py
===================================================================
--- trunk/python-ogre/demos/OgreNewt/Demo05_SimpleVehicle.py 2008-11-08 01:46:46 UTC (rev 788)
+++ trunk/python-ogre/demos/OgreNewt/Demo05_SimpleVehicle.py 2008-11-10 17:16:49 UTC (rev 789)
@@ -78,7 +78,6 @@
light.setType( Ogre.Light.LT_POINT )
light.setPosition( Ogre.Vector3(0.0, 100.0, 100.0) )
-
def makeSimpleBox( self, size, pos, orient ):
## base mass on the size of the object.
mass = size.x * size.y * size.z * 2.5
Modified: trunk/python-ogre/demos/OgreNewt/Demo07_CustomJoints.py
===================================================================
--- trunk/python-ogre/demos/OgreNewt/Demo07_CustomJoints.py 2008-11-08 01:46:46 UTC (rev 788)
+++ trunk/python-ogre/demos/OgreNewt/Demo07_CustomJoints.py 2008-11-10 17:16:49 UTC (rev 789)
@@ -81,13 +81,13 @@
del col
body.attachToNode( floornode )
- body.setPositionOrientation( Ogre.Vector3(0.0,-20.0,0.0), Ogre.Quaternion.IDENTITY )
+ body.setPositionOrientation( Ogre.Vector3(0.0,-20.0,0.0), Ogre.Quaternion().IDENTITY )
self.bodies.append(body)
## make a simple rope.
size = Ogre.Vector3(3,1.5,1.5)
pos = Ogre.Vector3(0,3,0)
- orient = Ogre.Quaternion.IDENTITY
+ orient = Ogre.Quaternion().IDENTITY
parent=None
@@ -98,11 +98,11 @@
## make the joint right between the bodies...
if (parent): # OgreNewt.BallAndSocket
joint = MyCustomBallSocket(child, parent,
- pos-Ogre.Vector3(size.x/2,0,0), Ogre.Vector3.UNIT_X )
+ pos-Ogre.Vector3(size.x/2,0,0), Ogre.Vector3().UNIT_X )
else:
## no parent, this is the first joint, so just pass None as the parent, to stick it to the "world"
joint = MyCustomBallSocket(child, None,
- pos-Ogre.Vector3(size.x/2,0,0), Ogre.Vector3.UNIT_X )
+ pos-Ogre.Vector3(size.x/2,0,0), Ogre.Vector3().UNIT_X )
## rememeber to make a copy
self.bodies.append ( joint )
Modified: trunk/python-ogre/demos/OgreNewt/Demo08_Ragdoll.py
===================================================================
--- trunk/python-ogre/demos/OgreNewt/Demo08_Ragdoll.py 2008-11-08 01:46:46 UTC (rev 788)
+++ trunk/python-ogre/demos/OgreNewt/Demo08_Ragdoll.py 2008-11-10 17:16:49 UTC (rev 789)
@@ -58,7 +58,7 @@
self.bodies.append( bod ) ## need to keep him so collision works
bod.attachToNode( floornode )
- bod.setPositionOrientation( Ogre.Vector3(0.0,-4.0,0.0), Ogre.Quaternion.IDENTITY )
+ bod.setPositionOrientation( Ogre.Vector3(0.0,-4.0,0.0), Ogre.Quaternion().IDENTITY )
self.bodies.append( bod )
## position camera
@@ -214,7 +214,7 @@
self.Ragdoll = None
self.RagNode.setPosition( Ogre.Vector3(0.0, -4.0, 0.0) )
- self.RagNode.setOrientation( Ogre.Quaternion.IDENTITY )
+ self.RagNode.setOrientation( Ogre.Quaternion().IDENTITY )
self.RagEntity.getAnimationState( "LOOP" ).setEnabled( True )
self.RagEntity.getAnimationState( "LOOP" ).setTimePosition( 0.0 )
Modified: trunk/python-ogre/demos/OgreNewt/MyCustomBallSocket.py
===================================================================
--- trunk/python-ogre/demos/OgreNewt/MyCustomBallSocket.py 2008-11-08 01:46:46 UTC (rev 788)
+++ trunk/python-ogre/demos/OgreNewt/MyCustomBallSocket.py 2008-11-10 17:16:49 UTC (rev 789)
@@ -18,6 +18,6 @@
globalOrient1, globalPos1 = OgreNewt.CustomJoint.localToGlobal( self, self.LocalOrient1, self.LocalPos1, 1 )
## to make the joint, we simply apply a constraint to connect 2 points on the bodies along all 3 major axis
- self.addLinearRow( globalPos0, globalPos1, globalOrient0 * Ogre.Vector3.UNIT_X )
- self.addLinearRow( globalPos0, globalPos1, globalOrient0 * Ogre.Vector3.UNIT_Y )
- self.addLinearRow( globalPos0, globalPos1, globalOrient0 * Ogre.Vector3.UNIT_Z )
+ self.addLinearRow( globalPos0, globalPos1, globalOrient0 * Ogre.Vector3().UNIT_X )
+ self.addLinearRow( globalPos0, globalPos1, globalOrient0 * Ogre.Vector3().UNIT_Y )
+ self.addLinearRow( globalPos0, globalPos1, globalOrient0 * Ogre.Vector3().UNIT_Z )
Modified: trunk/python-ogre/demos/OgreNewt/SimpleVehicle.py
===================================================================
--- trunk/python-ogre/demos/OgreNewt/SimpleVehicle.py 2008-11-08 01:46:46 UTC (rev 788)
+++ trunk/python-ogre/demos/OgreNewt/SimpleVehicle.py 2008-11-10 17:16:49 UTC (rev 789)
@@ -21,6 +21,7 @@
## function "setup" to finish building the vehicle.
## you pass this function the body to be used as the main chassis, and the up direction of the world (for suspension purposes).
self.init( self.chassis, Ogre.Vector3(0,1,0) )
+
## the above function calls our "setup" function, which takes care of the rest of the vehicle setup.
@@ -31,13 +32,13 @@
## calculate the inertia based on box formula and mass
inertia = OgreNewt.CalcBoxSolid( mass, size )
-
+
box1 = self.sceneManager.createEntity( "Entity"+str(EntityCount), "box.mesh" )
EntityCount += 1
box1node = self.sceneManager.getRootSceneNode().createChildSceneNode()
box1node.attachObject( box1 )
box1node.setScale( size )
-
+
col = OgreNewt.Box( self.World, size )
bod = OgreNewt.Body( self.World, col )
del col
@@ -47,10 +48,9 @@
bod.setStandardForceCallback()
box1.setMaterialName( "Examples/BumpyMetal" )
- box1.setNormaliseNormals(True)
-
+
bod.setPositionOrientation( pos, orient )
-
+
return bod
@@ -151,6 +151,7 @@
self.SteeringTire = steer;
def __del__ ( self ):
+# print "IN DELETE of Tire"
## destroy entity, and scene node.
m_node= self.getOgreNode()
print m_node
Modified: trunk/python-ogre/demos/OgreNewt/ragdoll.py
===================================================================
--- trunk/python-ogre/demos/OgreNewt/ragdoll.py 2008-11-08 01:46:46 UTC (rev 788)
+++ trunk/python-ogre/demos/OgreNewt/ragdoll.py 2008-11-10 17:16:49 UTC (rev 789)
@@ -25,15 +25,15 @@
self.OgreBone = ogreBone
## in the case of the cylindrical primitives, they need to be rotated to align the main axis with the direction vector.
- orient = Ogre.Quaternion.IDENTITY
- pos = Ogre.Vector3.ZERO
+ orient = Ogre.Quaternion().IDENTITY
+ pos = Ogre.Vector3().ZERO
rot = Ogre.Matrix3()
- if (dir1 == Ogre.Vector3.UNIT_Y):
+ if (dir1 == Ogre.Vector3().UNIT_Y):
rot.FromEulerAnglesXYZ(Ogre.Degree(0), Ogre.Degree(0), Ogre.Degree(90))
orient.FromRotationMatrix( rot )
- if (dir1 == Ogre.Vector3.UNIT_Z):
+ if (dir1 == Ogre.Vector3().UNIT_Z):
rot.FromEulerAnglesXYZ(Ogre.Degree(0), Ogre.Degree(90), Ogre.Degree(0))
orient.FromRotationMatrix( rot )
@@ -77,7 +77,7 @@
boneIndex = self.OgreBone.getHandle()
invMatrix = Ogre.Matrix4 ()
invMatrix.makeInverseTransform( -self.OgreBone._getBindingPoseInversePosition(),
- Ogre.Vector3.UNIT_SCALE / self.OgreBone._getBindingPoseInverseScale(),
+ Ogre.Vector3().UNIT_SCALE / self.OgreBone._getBindingPoseInverseScale(),
self.OgreBone._getBindingPoseInverseOrientation().Inverse())
num_sub = mesh.getNumSubMeshes()
@@ -147,7 +147,7 @@
## To Check - might need to keep vertexVector around - ie as a self.vertexVector
## Note the helper function -- the Constructor on ConvexHull needs a pointer to a list of Vector3's
col = OgreNewt.createConvexHull( world, vertexVector, len(vertexVector) )
- #.Ogre.Quaternion.IDENTITY, Ogre.Vector3.ZERO )
+ #.Ogre.Quaternion().IDENTITY, Ogre.Vector3().ZERO )
return col
## newton body.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|