electrodynamics/src/main/scala/edx/core/interfaces/TNodeMechanical.scala

70 lines
1.7 KiB
Scala
Raw Normal View History

2015-01-14 12:06:03 +01:00
package edx.core.interfaces
2015-01-26 12:40:32 +01:00
import resonantengine.api.tile.node.INode
import resonantengine.lib.transform.vector.IVectorWorld
/**
* Applied to any node that will act as a mechanical object
*
2014-11-09 05:06:09 +01:00
* @author Darkguardsman, Calclavia
*/
trait TNodeMechanical extends INode with IVectorWorld
2014-11-09 05:06:09 +01:00
{
/**
2014-11-09 05:06:09 +01:00
* Gets the angular velocity of the mechanical device from a specific side
*
2014-11-09 05:06:09 +01:00
* @return Angular velocity in meters per second
*/
def angularVelocity: Double
/**
2014-11-09 05:06:09 +01:00
* Gets the torque of the mechanical device from a specific side
*
* @return force
*/
def torque: Double
2014-11-13 16:04:21 +01:00
/**
* The mechanical resistance of this node.
* Consider the moment of inertia, which equals mass * radius ^ 2
*
* Torque = Moment of Intertia * angular velocity
*
* A higher resistance or moment of inertia means that it is more difficult for this mechanical node to accelerate.
*
2015-01-23 04:41:55 +01:00
* @return Moment of intertia
2014-11-13 16:04:21 +01:00
*/
def inertia = 10D
2014-11-13 16:04:21 +01:00
2015-01-23 04:41:55 +01:00
/**
* Friction is a factor that decelerates the mechanical system based on angular velocity.
*/
def friction = 1D
2014-11-13 16:04:21 +01:00
/**
* The radius of rotation
2014-11-13 16:04:21 +01:00
*/
2014-11-21 05:17:28 +01:00
def radius(other: TNodeMechanical) = 0.5
2014-11-13 16:04:21 +01:00
/**
* Does the direction flip on this side for rotation
*
* @param prev - The other mechanical node
* @return boolean, true = flipped, false = not
*/
def inverseRotation(prev: TNodeMechanical): Boolean = true
/**
* Does this node flip the next node's rotation?
* @param next - The next node
* @return True to flip the next node
*/
def inverseNext(next: TNodeMechanical): Boolean = true
/**
* Applies rotational force and velocity to this node increasing its current rotation value
*
* @param torque - force at an angle
*/
def accelerate(torque: Double)
}