physic

package
v0.0.0-...-620f6c9 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Player_Bit = iota
	Enemy_Bit
	Skill_Bit
	Terrain_Bit
	Specified_Bit
	AOE_Bit
	TREASURE_Bit
	TeamA_Bit
	TeamB_Bit
	TeamC_Bit
	TeamD_Bit
)

ObjCategory

View Source
const (
	No_Team_Mode = iota
	Team_Mode
)

Variables

This section is empty.

Functions

func DirectionV3ToQuaternion

func DirectionV3ToQuaternion(v3 *lin.V3) ode.Quaternion

func EulerToQuaternion

func EulerToQuaternion(yaw, pitch, roll float64) *lin.Q

func GetCollideHandler

func GetCollideHandler(w *World) func(data interface{}, obj1, obj2 ode.Geom)

func Q_LinToMsg

func Q_LinToMsg(q *lin.Q) (msg *Quaternion)

func Q_LinToOde

func Q_LinToOde(q *lin.Q) ode.Quaternion

func Q_MsgToOde

func Q_MsgToOde(msg *Quaternion) (q ode.Quaternion)

func Q_OdeToLin

func Q_OdeToLin(q ode.Quaternion) *lin.Q

func Q_OdeToMsg

func Q_OdeToMsg(q ode.Quaternion) (msg *Quaternion)

func SetAllBits

func SetAllBits() int

func SetBitExcept

func SetBitExcept(b int, bits ...uint) int

func SetBits

func SetBits(b int, bits ...uint) int

func V3_LinToMsg

func V3_LinToMsg(p *lin.V3) (msg *Vector3)

func V3_LinToOde

func V3_LinToOde(v3 *lin.V3) ode.Vector3

func V3_MsgToOde

func V3_MsgToOde(msg *Vector3) (v3 ode.Vector3)

func V3_OdeToLin

func V3_OdeToLin(q ode.Vector3) *lin.V3

func V3_OdeToMsg

func V3_OdeToMsg(v3 ode.Vector3) (msg *Vector3)

Types

type CollideCallback

type CollideCallback func(data interface{}, obj1, obj2 ode.Geom)

type Obj

type Obj struct {
	sync.Mutex
	CBody       ode.Body
	CGeom       ode.Geom
	Space       ode.Space
	AOE         ode.Geom
	OtherBodys  []ode.Body
	OtherGeoms  []ode.Geom
	Data        *ObjData
	CollideObjs map[*Obj]int64
	AOEObjs     map[int64]ode.Vector3
}

func (*Obj) AddBody

func (obj *Obj) AddBody(body ode.Body)

func (*Obj) AddGeom

func (obj *Obj) AddGeom(geom ode.Geom)

func (*Obj) ClearAOE

func (obj *Obj) ClearAOE()

func (*Obj) Collide

func (obj *Obj) Collide(obj2 *Obj)

func (*Obj) CreateAOE

func (obj *Obj) CreateAOE(space ode.Space, radius float64)

func (*Obj) Destroy

func (obj *Obj) Destroy()

func (*Obj) GetData

func (obj *Obj) GetData() *ObjData

func (*Obj) InAOE

func (obj *Obj) InAOE(entityId int64, p ode.Vector3)

func (*Obj) LoopCollideObj

func (obj *Obj) LoopCollideObj(f func(obj *Obj, times int64) bool)

func (*Obj) ResetCollide

func (obj *Obj) ResetCollide()

func (*Obj) SetData

func (obj *Obj) SetData(objData ObjData)

func (*Obj) SyncAOEPos

func (obj *Obj) SyncAOEPos()

type ObjData

type ObjData struct {
	Uuid         int64
	Type         string
	Name         string
	CollideTimes int64
}

type Objs

type Objs struct {
	sync.Map
}

func (*Objs) Get

func (g *Objs) Get(id int64) (*Obj, bool)

type World

type World struct {
	sync.RWMutex
	World ode.World
	Space ode.Space
	Floor ode.Plane
	CtGrp ode.JointGroup
	Objs  Objs
	Cb    func(data interface{}, obj1, obj2 ode.Geom)
}

func (*World) AddObj

func (w *World) AddObj(id int64, obj *Obj)

func (*World) CreateEntity

func (w *World) CreateEntity(objName string, id int64, pos lin.V3, rot lin.Q)

func (*World) CreateTerrain

func (w *World) CreateTerrain()

func (*World) DeleteObj

func (w *World) DeleteObj(id int64)

func (*World) Destroy

func (w *World) Destroy()

func (*World) GetAllTransform

func (w *World) GetAllTransform() (pos *Position)

func (*World) GetTransform

func (w *World) GetTransform(id int64) (p *lin.V3, q *lin.Q)

func (*World) Init

func (w *World) Init(roomId int64)

func (*World) Move

func (w *World) Move(id int64, v float64, omega float64)

func (*World) PhysicUpdate

func (w *World) PhysicUpdate()

func (*World) SetTranform

func (w *World) SetTranform(id int64, t *TransForm)

type WorldData

type WorldData struct {
	Cb    func(data interface{}, obj1, obj2 ode.Geom)
	CtGrp ode.JointGroup
}

Jump to

Keyboard shortcuts

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