mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
*** empty log message ***
This commit is contained in:
parent
3e5939ead1
commit
d15ab3c91b
@ -1,4 +1,4 @@
|
|||||||
// Filename: LinearIntegrator.cxx
|
// Filename: LinearIntegrator.C
|
||||||
// Created by: charles (02Aug00)
|
// Created by: charles (02Aug00)
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -37,9 +37,27 @@ LinearIntegrator::
|
|||||||
void LinearIntegrator::
|
void LinearIntegrator::
|
||||||
integrate(Physical *physical, vector< PT(LinearForce) > &forces,
|
integrate(Physical *physical, vector< PT(LinearForce) > &forces,
|
||||||
float dt) {
|
float dt) {
|
||||||
|
/*// darren, 2000.10.06
|
||||||
// cap dt so physics don't go flying off on lags
|
// cap dt so physics don't go flying off on lags
|
||||||
if (dt > _max_linear_dt)
|
if (dt > _max_linear_dt)
|
||||||
dt = _max_linear_dt;
|
dt = _max_linear_dt;
|
||||||
|
*/
|
||||||
|
|
||||||
|
vector< PT(PhysicsObject) >::const_iterator current_object_iter;
|
||||||
|
current_object_iter = physical->get_object_vector().begin();
|
||||||
|
for (; current_object_iter != physical->get_object_vector().end();
|
||||||
|
current_object_iter++) {
|
||||||
|
PhysicsObject *current_object = *current_object_iter;
|
||||||
|
|
||||||
|
// bail out if this object doesn't exist or doesn't want to be
|
||||||
|
// processed.
|
||||||
|
if (current_object == (PhysicsObject *) NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// set the object's last position to its current position before we move it
|
||||||
|
current_object->set_last_position(current_object->get_position());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
child_integrate(physical, forces, dt);
|
child_integrate(physical, forces, dt);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,29 @@ set_position(float x, float y, float z) {
|
|||||||
_position.set(x, y, z);
|
_position.set(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function : set_position_HandOfGod
|
||||||
|
// Access : Public
|
||||||
|
// Description : use this to place an object in a completely new
|
||||||
|
// position, that has nothing to do with its last
|
||||||
|
// position (moved by the Hand Of God, or "HOG")
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void PhysicsObject::
|
||||||
|
set_position_HandOfGod(const LPoint3f &pos) {
|
||||||
|
_position = pos;
|
||||||
|
_last_position = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function : set_last_position
|
||||||
|
// Access : Public
|
||||||
|
// Description : Last position assignment
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void PhysicsObject::
|
||||||
|
set_last_position(const LPoint3f& pos) {
|
||||||
|
_last_position = pos;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function : set_velocity
|
// Function : set_velocity
|
||||||
// Access : Public
|
// Access : Public
|
||||||
@ -93,6 +116,16 @@ get_position(void) const {
|
|||||||
return _position;
|
return _position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function : get_last_position
|
||||||
|
// Access : Public
|
||||||
|
// Description : Last position Query
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE LPoint3f PhysicsObject::
|
||||||
|
get_last_position(void) const {
|
||||||
|
return _last_position;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function : get_velocity
|
// Function : get_velocity
|
||||||
// Access : Public
|
// Access : Public
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Filename: physics_object.cxx
|
// Filename: physics_object.C
|
||||||
// Created by: charles (13Jun00)
|
// Created by: charles (13Jun00)
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -17,6 +17,7 @@ PhysicsObject(void) :
|
|||||||
_process_me(false), _mass(1.0f), _oriented(true),
|
_process_me(false), _mass(1.0f), _oriented(true),
|
||||||
_terminal_velocity(_default_terminal_velocity) {
|
_terminal_velocity(_default_terminal_velocity) {
|
||||||
_position.set(0, 0, 0);
|
_position.set(0, 0, 0);
|
||||||
|
_last_position = _position;
|
||||||
_velocity.set(0, 0, 0);
|
_velocity.set(0, 0, 0);
|
||||||
_orientation.set(1, 0, 0, 0);
|
_orientation.set(1, 0, 0, 0);
|
||||||
_rotation.set(0, 0, 0);
|
_rotation.set(0, 0, 0);
|
||||||
@ -51,6 +52,7 @@ operator =(const PhysicsObject &other) {
|
|||||||
_process_me = other._process_me;
|
_process_me = other._process_me;
|
||||||
_mass = other._mass;
|
_mass = other._mass;
|
||||||
_position = other._position;
|
_position = other._position;
|
||||||
|
_last_position = other._last_position;
|
||||||
_velocity = other._velocity;
|
_velocity = other._velocity;
|
||||||
_orientation = other._orientation;
|
_orientation = other._orientation;
|
||||||
_rotation = other._rotation;
|
_rotation = other._rotation;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#ifndef PHYSICS_OBJECT_H
|
#ifndef PHYSICS_OBJECT_H
|
||||||
#define PHYSICS_OBJECT_H
|
#define PHYSICS_OBJECT_H
|
||||||
|
|
||||||
#include <pandabase.h>
|
#include <compiler.h>
|
||||||
#include <typedReferenceCount.h>
|
#include <typedReferenceCount.h>
|
||||||
#include <luse.h>
|
#include <luse.h>
|
||||||
|
|
||||||
@ -20,6 +20,7 @@ class EXPCL_PANDAPHYSICS PhysicsObject : public TypedReferenceCount {
|
|||||||
private:
|
private:
|
||||||
// physical
|
// physical
|
||||||
LPoint3f _position;
|
LPoint3f _position;
|
||||||
|
LPoint3f _last_position;
|
||||||
LVector3f _velocity;
|
LVector3f _velocity;
|
||||||
|
|
||||||
// angular
|
// angular
|
||||||
@ -47,6 +48,11 @@ public:
|
|||||||
INLINE void set_position(float x, float y, float z);
|
INLINE void set_position(float x, float y, float z);
|
||||||
INLINE LPoint3f get_position(void) const;
|
INLINE LPoint3f get_position(void) const;
|
||||||
|
|
||||||
|
INLINE void set_position_HandOfGod(const LPoint3f &pos);
|
||||||
|
|
||||||
|
INLINE void set_last_position(const LPoint3f &pos);
|
||||||
|
INLINE LPoint3f get_last_position(void) const;
|
||||||
|
|
||||||
INLINE void set_velocity(const LVector3f &vel);
|
INLINE void set_velocity(const LVector3f &vel);
|
||||||
INLINE void set_velocity(float x, float y, float z);
|
INLINE void set_velocity(float x, float y, float z);
|
||||||
INLINE LVector3f get_velocity(void) const;
|
INLINE LVector3f get_velocity(void) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user