particle.go 685 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2016 The G3N Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package physics
  5. import (
  6. "github.com/g3n/engine/math32"
  7. "github.com/g3n/engine/graphic"
  8. )
  9. // Particle represents a physics-driven particle.
  10. type Particle struct {
  11. Body
  12. mass float32
  13. radius float32
  14. position math32.Vector3
  15. velocity math32.Vector3
  16. //netForce math32.Vector3
  17. colliding bool
  18. }
  19. // NewParticle creates and returns a pointer to a new Particle.
  20. func NewParticle(igraphic graphic.IGraphic) *Particle {
  21. p := new(Particle)
  22. p.Graphic = igraphic.GetGraphic()
  23. p.mass = 1
  24. p.radius = 1
  25. return p
  26. }