AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
GroupFooCollider.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agx/macros.h>
23
25
26namespace agxCollide
27{
28 template <agx::UInt8 ShapeType>
29 class GroupFooCollider : public ShapeCollider
30 {
31 public:
32 GroupFooCollider() : ShapeCollider(agxCollide::Shape::GROUP, ShapeType) {}
33 virtual ~GroupFooCollider() {}
34
35 virtual void _calculateContacts(
36 agx::Physics::Geometry::ShapeInstance shape1, agx::Physics::Geometry::ShapeInstance shape2,
37 const agx::AffineMatrix4x4&, const agx::AffineMatrix4x4& transform2,
39 const agx::Vec3& linearVelocity1, const agx::Vec3& linearVelocity2,
40#else
41 const agx::Vec3& /*linearVelocity1*/, const agx::Vec3& linearVelocity2,
42#endif
43 const agx::Vec3& angularVelocity1, const agx::Vec3& angularVelocity2,
44 bool /*earlyOut*/, LocalContactPointVector& result) override
45 {
46 agx::Physics::Geometry::ShapeGroupInstance group = shape1;
47
48
49 const agx::Vector<agx::Physics::Geometry::ShapePtr>& childShapes = group.childShapes();
50 // const agx::Vector<AffineMatrix4x4>& childTransforms = group.childTransforms();
51 for (size_t i = 0; i < childShapes.size(); ++i)
52 {
53 agx::Physics::Geometry::ShapeInstance childShape = childShapes[i];
54
55 ShapeCollider *collider = ColliderTable::getCollider(childShape.type(), shape2.type());
56
57 // AffineMatrix4x4& localTransform = childTransforms[i];
58 // AffineMatrix4x4 childTransform = localTransform * transform1;
59
60 #if SHAPE_COLLIDER_VELOCITIES
61 agx::Vec3 childLinearVelocity = (angularVelocity1 ^ localTransform.getTranslate()) + linearVelocity1;
62 #else
63 agx::Vec3 childLinearVelocity;
64 #endif
65
66 if ( !collider )
67 continue;
68
69 collider->calculateContacts(
70 childShape, shape2,
71 childShape.transform(), transform2,
72 childLinearVelocity, linearVelocity2,
73 angularVelocity1, angularVelocity2,
74 false, result);
75 }
76 }
77 };
78}
79
81
#define SHAPE_COLLIDER_VELOCITIES
size_t size() const
Definition Container.h:134
Templated vector class.
Definition agx/Vector.h:53
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition macros.h:96
This namespace consists of a set of classes for handling geometric intersection tests including boole...