Skip to content

Instantly share code, notes, and snippets.

@pyokagan
Created June 27, 2012 07:08
Show Gist options
  • Select an option

  • Save pyokagan/3002162 to your computer and use it in GitHub Desktop.

Select an option

Save pyokagan/3002162 to your computer and use it in GitHub Desktop.
Bouncy Boar 3 Island Object
Imports BouncyBoar3
Namespace MyGame
Namespace Nodes
''' <summary>
'''
''' </summary>
''' <remarks>
''' Should be put inside a collisionGroup for maximum efficiency
''' You need to add manual collisionboxes for the trees
'''</remarks>
Public Class Island5
Inherits BouncyBoar.Game.Node
Private P_NativeEntity As Mogre.Entity
Private P_NativeTreeEntity As Mogre.Entity
Private P_NativeMetalEntity As Mogre.Entity
Private P_NativeGeometry As Mogre.StaticGeometry
Private P_Position As Mogre.Vector3
Private P_MainBoundingBox As BouncyBoar.Game.Collision.AABoundingBox
Public Sub New(ByVal IslandName As String, ByVal IslandPos As Mogre.Vector3)
MyBase.New(IslandName)
P_Position = New Mogre.Vector3(IslandPos.x, IslandPos.y, IslandPos.z)
P_MainBoundingBox = New BouncyBoar.Game.Collision.AABoundingBox(New Mogre.Vector3(P_Position.x - 750, P_Position.y - 750, P_Position.z - 750), New Mogre.Vector3(P_Position.z + 750, P_Position.y + 750, P_Position.z + 750))
End Sub
Public Sub ResetBoundingBox()
P_MainBoundingBox.Min = New Mogre.Vector3(P_Position.x - 750, P_Position.y - 750, P_Position.z - 750)
P_MainBoundingBox.Max = New Mogre.Vector3(P_Position.x + 750, P_Position.y + 750, P_Position.z + 750)
End Sub
Public Overrides Sub Initialise(ByVal TheParentRoom As BouncyBoar.Game.Room)
MyBase.Initialise(TheParentRoom)
P_NativeEntity = ParentRoom.SceneManager.CreateEntity(Name & "_entity", "Island04.mesh")
P_NativeTreeEntity = ParentRoom.SceneManager.CreateEntity(Name & "_tree", "Tree01.mesh")
P_NativeMetalEntity = ParentRoom.SceneManager.CreateEntity(Name & "_metalplatform", "MetalPlatform0.mesh")
P_NativeGeometry = ParentRoom.SceneManager.CreateStaticGeometry(Name & "_geometry")
P_NativeGeometry.AddEntity(P_NativeEntity, P_Position)
'Trees
P_NativeGeometry.AddEntity(P_NativeTreeEntity, P_Position + New Mogre.Vector3(650, 240, 650))
P_NativeGeometry.AddEntity(P_NativeTreeEntity, P_Position + New Mogre.Vector3(-650, 240, -650))
P_NativeGeometry.AddEntity(P_NativeTreeEntity, P_Position + New Mogre.Vector3(650, 240, -650))
P_NativeGeometry.AddEntity(P_NativeTreeEntity, P_Position + New Mogre.Vector3(-650, 240, 650))
'Metal platform
P_NativeGeometry.AddEntity(P_NativeMetalEntity, P_Position + New Mogre.Vector3(1400, 40, 0))
P_NativeGeometry.AddEntity(P_NativeMetalEntity, P_Position + New Mogre.Vector3(2400, 40, 0))
P_NativeGeometry.AddEntity(P_NativeMetalEntity, P_Position + New Mogre.Vector3(-1400, 40, 0))
P_NativeGeometry.AddEntity(P_NativeMetalEntity, P_Position + New Mogre.Vector3(-2400, 40, 0))
P_NativeGeometry.AddEntity(P_NativeMetalEntity, P_Position + New Mogre.Vector3(0, 40, -1400))
P_NativeGeometry.AddEntity(P_NativeMetalEntity, P_Position + New Mogre.Vector3(0, 40, -2400))
P_NativeGeometry.AddEntity(P_NativeMetalEntity, P_Position + New Mogre.Vector3(2000, 40, -1000))
P_NativeGeometry.AddEntity(P_NativeMetalEntity, P_Position + New Mogre.Vector3(-1600, 40, -1000))
P_NativeGeometry.Build()
End Sub
Public Overrides Property Position() As Mogre.Vector3
Get
Return P_Position
End Get
Set(ByVal value As Mogre.Vector3)
P_Position = value
End Set
End Property
Public Overrides Sub Removed()
MyBase.Removed()
ParentRoom.SceneManager.DestroyStaticGeometry(Name & "_geometry")
ParentRoom.SceneManager.DestroyEntity(Name & "_entity")
P_NativeEntity = Nothing
P_NativeGeometry = Nothing
End Sub
Public Overrides ReadOnly Property BoundingBox() As BouncyBoar.Game.Collision.AABoundingBox
Get
Return MyBase.BoundingBox
End Get
End Property
End Class
End Namespace
End Namespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment