Chipmunk - Go Packages

Go.
  • Why Go Why Go
    • Case Studies
    • Use Cases
    • Security Policy
  • Learn
  • Docs Docs
    • Effective Go
    • Go User Manual
    • Standard library
    • Release Notes
  • Packages
  • Community Community
    • Recorded Talks
    • Meetups
    • Conferences
    • Go blog
    • Go project
    • Get connected

Details

  • Valid go.mod file

    The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.

  • Redistributable license

    Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.

  • Tagged version

    Modules with tagged versions give importers more predictable builds.

  • Stable version

    When a project reaches major version v1 it is considered stable.

  • Learn more about best practices

Repository

github.com/andrebq/exp

Links

  • Open Source Insights Logo Open Source Insights
Jump to ...
  • Documentation
    • Overview
    • Index
    • Constants
    • Variables
    • Functions
      • MomentForBox(mass, width, height)
      • MomentForCircle(mass, innerDiameter, outerDiameter, offset)
    • Types
      • type Body
        • NewBody(mass, moment)
        • (b) Free()
        • (b) Pos()
        • (b) SetPos(p)
        • (b) Vel()
      • type Layer
        • (l) Not()
      • type Shape
        • NewBoxShape(body, width, height)
        • NewCircleShape(body, radius, center)
        • NewSegmentShape(body, a, b, radius)
        • (s) Free()
        • (s) SetElasticity(val)
        • (s) SetFriction(val)
        • (s) SetLayers(layer)
      • type Space
        • NewSpace()
        • (s) AddBody(body)
        • (s) AddShape(shape)
        • (s) Free()
        • (s) SetCollisionSlop(value)
        • (s) SetGravity(g)
        • (s) SetIterations(count)
        • (s) SetSleepTimeThreshold(value)
        • (s) StaticBody()
        • (s) Step(timeStep)
        • (s) StepSeconds(totalSeconds, timeStep)
      • type Vect
        • V(x, y)
        • VZero()
  • Source Files
Documentation

Documentation ¶

Overview ¶

  • See chipmunk-physics.net for chipmunk source-code

Chipmunk-GO binding for chipmunk physics engine

See chipmunk-physics.net for chipmunk source-code ¶

Just like the original code, this binding is released under the MIT license. See LICENSE for more details.

IMPORTANT! The current code might leak memory since chipmunk allocated objects need to be manually free'd. You should use defer obj.Free() but the order is important!

* free all shapes * free all bodies * free the space object

This is the opposite of the creation order and therefor you can't use defer the usual way (at least not now).

Index ¶

  • Constants
  • func MomentForBox(mass, width, height float32) float32
  • func MomentForCircle(mass, innerDiameter, outerDiameter float32, offset Vect) float32
  • type Body
    • func NewBody(mass, moment float32) Body
    • func (b *Body) Free()
    • func (b *Body) Pos() Vect
    • func (b *Body) SetPos(p Vect)
    • func (b *Body) Vel() Vect
  • type Layer
    • func (l Layer) Not() Layer
  • type Shape
    • func NewBoxShape(body Body, width, height float32) Shape
    • func NewCircleShape(body Body, radius float32, center Vect) Shape
    • func NewSegmentShape(body Body, a, b Vect, radius float32) Shape
    • func (s *Shape) Free()
    • func (s *Shape) SetElasticity(val float32)
    • func (s *Shape) SetFriction(val float32)
    • func (s *Shape) SetLayers(layer Layer)
  • type Space
    • func NewSpace() Space
    • func (s *Space) AddBody(body Body) Body
    • func (s *Space) AddShape(shape Shape) Shape
    • func (s *Space) Free()
    • func (s *Space) SetCollisionSlop(value float32)
    • func (s *Space) SetGravity(g Vect)
    • func (s *Space) SetIterations(count int)
    • func (s *Space) SetSleepTimeThreshold(value float32)
    • func (s *Space) StaticBody() Body
    • func (s *Space) Step(timeStep float32)
    • func (s *Space) StepSeconds(totalSeconds, timeStep float32)
  • type Vect
    • func V(x, y float32) Vect
    • func VZero() Vect

Constants ¶

View Source const ( // NEGATE_LAYER is used to negate a given layer NEGATE_LAYER = Layer(uint(math.MaxUint32)) // ALL_LAYERS indicates that a shape is in every layer ALL_LAYERS = Layer(C.CP_ALL_LAYERS) )

Variables ¶

This section is empty.

Functions ¶

func MomentForBox ¶

func MomentForBox(mass, width, height float32) float32

func MomentForCircle ¶

func MomentForCircle(mass, innerDiameter, outerDiameter float32, offset Vect) float32

Types ¶

type Body ¶

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

func NewBody ¶

func NewBody(mass, moment float32) Body

func (*Body) Free ¶

func (b *Body) Free()

func (*Body) Pos ¶

func (b *Body) Pos() Vect

func (*Body) SetPos ¶

func (b *Body) SetPos(p Vect)

func (*Body) Vel ¶

func (b *Body) Vel() Vect

type Layer ¶

type Layer uint

Layer used by chipmunk

func (Layer) Not ¶

func (l Layer) Not() Layer

Return the negated version of this layer

type Shape ¶

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

func NewBoxShape ¶

func NewBoxShape(body Body, width, height float32) Shape

func NewCircleShape ¶

func NewCircleShape(body Body, radius float32, center Vect) Shape

func NewSegmentShape ¶

func NewSegmentShape(body Body, a, b Vect, radius float32) Shape

func (*Shape) Free ¶

func (s *Shape) Free()

func (*Shape) SetElasticity ¶

func (s *Shape) SetElasticity(val float32)

func (*Shape) SetFriction ¶

func (s *Shape) SetFriction(val float32)

func (*Shape) SetLayers ¶

func (s *Shape) SetLayers(layer Layer)

type Space ¶

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

func NewSpace ¶

func NewSpace() Space

func (*Space) AddBody ¶

func (s *Space) AddBody(body Body) Body

func (*Space) AddShape ¶

func (s *Space) AddShape(shape Shape) Shape

func (*Space) Free ¶

func (s *Space) Free()

func (*Space) SetCollisionSlop ¶

func (s *Space) SetCollisionSlop(value float32)

func (*Space) SetGravity ¶

func (s *Space) SetGravity(g Vect)

func (*Space) SetIterations ¶

func (s *Space) SetIterations(count int)

func (*Space) SetSleepTimeThreshold ¶

func (s *Space) SetSleepTimeThreshold(value float32)

func (*Space) StaticBody ¶

func (s *Space) StaticBody() Body

func (*Space) Step ¶

func (s *Space) Step(timeStep float32)

func (*Space) StepSeconds ¶

func (s *Space) StepSeconds(totalSeconds, timeStep float32)

Run the simulation for at least totalSeconds.

In order to keep the fixed timestep if totalSeconds / timeStep != 0 the total number of seconds simulated might be totalSeconds + timeStep seconds of simulation.

The number of seconds here isn't related to the number of wall clock time, but instead this means how many seconds on the simulation should be consumed

type Vect ¶

type Vect C.cpVect

func V ¶

func V(x, y float32) Vect

func VZero ¶

func VZero() Vect

Source Files ¶

View all Source files
  • chipmunk.go
  • doc.go
Click to show internal directories. Click to hide internal directories.

Jump to

Close

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
Close go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic. Learn more. Okay