car

package module
v0.0.0-...-cc66bed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2013 License: GPL-2.0 Imports: 2 Imported by: 1

README

carsim

A car simulation game

Documentation

Index

Constants

View Source
const (
	Gravity = 9.8
)

Variables

This section is empty.

Functions

func IsZero

func IsZero(v glm.Vec4d) bool

Types

type Car

type Car struct {
	Profile                    Profile
	Center                     glm.Vec4d
	Velocity                   glm.Vec4d
	Direction                  glm.Vec4d
	RearWheelAngularVelocity   float64
	RearWheelAngularDeviation  float64
	FrontWheelAngularDeviation float64
	FrontWheelO                float64

	//Transient properties for numerical integration
	TransientAcceleration glm.Vec4d
}

func NewCar

func NewCar() Car

func (*Car) Simulate

func (car *Car) Simulate(controls Controls, timestep float64)

type Controls

type Controls struct {
	FuelPedal            float64
	BreakPedal           float64
	WheelAngularVelocity float64
}

type EngineProfile

type EngineProfile interface {
	Torque(rpm float64) float64
	StallingRPM() float64
}

type Profile

type Profile struct {
	Mass              float64 //Kg
	Engine            EngineProfile
	Drag              float64
	RollingResistance float64
	BreakingPower     float64 //N

	CenterOfGravityHeight float64 //m
	RearAxelDisplacement  float64 //m
	FrontAxelDisplacement float64 //m
	TyreFrictionMu        float64
	TyreTractionConstant  float64

	GearRatio              float64
	DifferentialRatio      float64
	TransmissionEfficiency float64
	WheelRadius            float64
	WheelMass              float64
	MaxStreeringAngle      float64
}

type SimpleEngine

type SimpleEngine struct {
	// contains filtered or unexported fields
}

func (*SimpleEngine) StallingRPM

func (engine *SimpleEngine) StallingRPM() float64

func (*SimpleEngine) Torque

func (engine *SimpleEngine) Torque(rpm float64) float64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL