Add Capsule collider
This commit is contained in:
		@@ -8,5 +8,6 @@ target_sources(${DAWN_TARGET_NAME}
 | 
			
		||||
  PRIVATE
 | 
			
		||||
    MeshRenderer.cpp
 | 
			
		||||
    CubeMeshHost.cpp
 | 
			
		||||
    CapsuleMeshHost.cpp
 | 
			
		||||
    MeshHost.cpp
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										21
									
								
								src/dawn/scene/components/display/mesh/CapsuleMeshHost.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/dawn/scene/components/display/mesh/CapsuleMeshHost.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
// Copyright (c) 2023 Dominic Masters
 | 
			
		||||
// 
 | 
			
		||||
// This software is released under the MIT License.
 | 
			
		||||
// https://opensource.org/licenses/MIT
 | 
			
		||||
 | 
			
		||||
#include "CapsuleMeshHost.hpp"
 | 
			
		||||
 | 
			
		||||
using namespace Dawn;
 | 
			
		||||
 | 
			
		||||
CapsuleMeshHost::CapsuleMeshHost(SceneItem *item) :
 | 
			
		||||
  MeshHost(item),
 | 
			
		||||
  radius(0.5f),
 | 
			
		||||
  height(1.0f)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CapsuleMeshHost::onStart() {
 | 
			
		||||
  useEffect([&]{
 | 
			
		||||
    CapsuleMesh::create(&this->mesh, radius, height);
 | 
			
		||||
  }, { &this->radius, &this->height })();
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										22
									
								
								src/dawn/scene/components/display/mesh/CapsuleMeshHost.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/dawn/scene/components/display/mesh/CapsuleMeshHost.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
// Copyright (c) 2023 Dominic Masters
 | 
			
		||||
// 
 | 
			
		||||
// This software is released under the MIT License.
 | 
			
		||||
// https://opensource.org/licenses/MIT
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "MeshHost.hpp"
 | 
			
		||||
#include "display/mesh/CapsuleMesh.hpp"
 | 
			
		||||
 | 
			
		||||
namespace Dawn {
 | 
			
		||||
  class CapsuleMeshHost : public MeshHost {
 | 
			
		||||
    public:
 | 
			
		||||
      // @optional
 | 
			
		||||
      StateProperty<float> radius;
 | 
			
		||||
      // @optional
 | 
			
		||||
      StateProperty<float> height;
 | 
			
		||||
 | 
			
		||||
      CapsuleMeshHost(SceneItem *item);
 | 
			
		||||
 | 
			
		||||
      void onStart() override;
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user