231 lines
7.2 KiB
Plaintext
231 lines
7.2 KiB
Plaintext
// Filename: physicsObject.I
|
|
// Created by: charles (13Jun00)
|
|
//
|
|
////////////////////////////////////////////////////////////////////
|
|
//
|
|
// PANDA 3D SOFTWARE
|
|
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
|
//
|
|
// All use of this software is subject to the terms of the Panda 3d
|
|
// Software license. You should have received a copy of this license
|
|
// along with this source code; you will also find a current copy of
|
|
// the license at http://www.panda3d.org/license.txt .
|
|
//
|
|
// To contact the maintainers of this program write to
|
|
// panda3d@yahoogroups.com .
|
|
//
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : set_mass
|
|
// Access : Public
|
|
// Description : Specify the mass of the object
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void PhysicsObject::
|
|
set_mass(float m) {
|
|
_mass = m;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : set_position
|
|
// Access : Public
|
|
// Description : Vector position assignment
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void PhysicsObject::
|
|
set_position(const LPoint3f& pos) {
|
|
_position = pos;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : set_position
|
|
// Access : Public
|
|
// Description : Piecewise position assignment
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void PhysicsObject::
|
|
set_position(float x, float y, float 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
|
|
// Access : Public
|
|
// Description : Vector velocity assignment
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void PhysicsObject::
|
|
set_velocity(const LVector3f& vel) {
|
|
_velocity = vel;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : set_velocity
|
|
// Access : Public
|
|
// Description : Piecewise velocity assignment
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void PhysicsObject::
|
|
set_velocity(float x, float y, float z) {
|
|
_velocity.set(x, y, z);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : set_active
|
|
// Access : Public
|
|
// Description : Process Flag assignment
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void PhysicsObject::
|
|
set_active(bool flag) {
|
|
_process_me = flag;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : set_terminal_velocity
|
|
// Access : Public
|
|
// Description : tv assignment
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void PhysicsObject::
|
|
set_terminal_velocity(float tv) {
|
|
_terminal_velocity = tv;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : get_mass
|
|
// Access : Public
|
|
// Description : Mass Query
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE float PhysicsObject::
|
|
get_mass(void) const {
|
|
return _mass;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : get_position
|
|
// Access : Public
|
|
// Description : Position Query
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE LPoint3f PhysicsObject::
|
|
get_position(void) const {
|
|
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
|
|
// Access : Public
|
|
// Description : Velocity Query
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE LVector3f PhysicsObject::
|
|
get_velocity(void) const {
|
|
return _velocity;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : get_active
|
|
// Access : Public
|
|
// Description : Process Flag Query
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE bool PhysicsObject::
|
|
get_active(void) const {
|
|
return _process_me;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : get_terminal_velocity
|
|
// Access : Public
|
|
// Description : tv query
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE float PhysicsObject::
|
|
get_terminal_velocity(void) const {
|
|
return _terminal_velocity;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : set_orientation
|
|
// Access : Public
|
|
// Description :
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void PhysicsObject::
|
|
set_orientation(const LOrientationf &orientation) {
|
|
_orientation = orientation;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : set_rotation
|
|
// Access : Public
|
|
// Description :
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void PhysicsObject::
|
|
set_rotation(const LVector3f &rotation) {
|
|
_rotation = rotation;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : get_orientation
|
|
// Access : Public
|
|
// Description :
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE LOrientationf PhysicsObject::
|
|
get_orientation(void) const {
|
|
return _orientation;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : get_rotation
|
|
// Access : Public
|
|
// Description :
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE LVector3f PhysicsObject::
|
|
get_rotation(void) const {
|
|
return _rotation;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : set_oriented
|
|
// Access : Public
|
|
// Description :
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE void PhysicsObject::
|
|
set_oriented(bool flag) {
|
|
_oriented = flag;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Function : get_oriented
|
|
// Access : Public
|
|
// Description :
|
|
////////////////////////////////////////////////////////////////////
|
|
INLINE bool PhysicsObject::
|
|
get_oriented(void) const {
|
|
return _oriented;
|
|
}
|