Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
bbcb7423
Commit
bbcb7423
authored
6 years ago
by
Fabian Paus
Browse files
Options
Downloads
Patches
Plain Diff
Support concave object collisions if the object is not dynamic
parent
0ec41fb1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SimDynamics/DynamicsEngine/BulletEngine/BulletObject.cpp
+25
-15
25 additions, 15 deletions
SimDynamics/DynamicsEngine/BulletEngine/BulletObject.cpp
SimDynamics/DynamicsEngine/BulletEngine/BulletObject.h
+2
-1
2 additions, 1 deletion
SimDynamics/DynamicsEngine/BulletEngine/BulletObject.h
with
27 additions
and
16 deletions
SimDynamics/DynamicsEngine/BulletEngine/BulletObject.cpp
+
25
−
15
View file @
bbcb7423
...
@@ -208,11 +208,11 @@ namespace SimDynamics
...
@@ -208,11 +208,11 @@ namespace SimDynamics
return
result
;
return
result
;
}
}
btCo
nvexHull
Shape
*
BulletObject
::
createConvexHullShape
(
VirtualRobot
::
TriMeshModelPtr
trimesh
)
btCo
llision
Shape
*
BulletObject
::
createConvexHullShape
(
VirtualRobot
::
TriMeshModelPtr
trimesh
)
{
{
VR_ASSERT
(
trimesh
);
VR_ASSERT
(
trimesh
);
// create triangle shape
// create triangle shape
btTri
angleMesh
*
btTrimesh
=
new
btTriangleMesh
();
btTri
mesh
.
reset
(
new
btTriangleMesh
()
)
;
//com = trimesh->getCOM();
//com = trimesh->getCOM();
...
@@ -247,25 +247,35 @@ namespace SimDynamics
...
@@ -247,25 +247,35 @@ namespace SimDynamics
Eigen::Matrix4f comConv = sceneObject->getGlobalPoseVisualization() * comLoc;
Eigen::Matrix4f comConv = sceneObject->getGlobalPoseVisualization() * comLoc;
com = comConv.block(0,3,3,1);*/
com = comConv.block(0,3,3,1);*/
// build convex hull
boost
::
shared_ptr
<
btConvexShape
>
btConvexShape
(
new
btConvexTriangleMeshShape
(
btTrimesh
));
btConvexShape
->
setMargin
(
btMargin
);
boost
::
shared_ptr
<
btShapeHull
>
btHull
(
new
btShapeHull
(
btConvexShape
.
get
()));
btHull
->
buildHull
(
btMargin
);
btConvexHullShape
*
btConvex
=
new
btConvexHullShape
();
btConvex
->
setLocalScaling
(
btVector3
(
1
,
1
,
1
));
for
(
int
i
=
0
;
i
<
btHull
->
numVertices
();
i
++
)
if
(
sceneObject
->
getSimulationType
()
==
VirtualRobot
::
SceneObject
::
Physics
::
eKinematic
)
{
{
btConvex
->
addPoint
(
btHull
->
getVertexPointer
()[
i
]);
// Support concave objects if they are not dynamic
return
new
btBvhTriangleMeshShape
(
btTrimesh
.
get
(),
false
);
}
}
else
{
// build convex hull
boost
::
shared_ptr
<
btConvexShape
>
btConvexShape
(
new
btConvexTriangleMeshShape
(
btTrimesh
.
get
()));
btConvexShape
->
setMargin
(
btMargin
);
btConvex
->
setMargin
(
btMargin
);
boost
::
shared_ptr
<
btShapeHull
>
btHull
(
new
btShapeHull
(
btConvexShape
.
get
()));
btHull
->
buildHull
(
btMargin
);
btConvexHullShape
*
btConvex
=
new
btConvexHullShape
();
btConvex
->
setLocalScaling
(
btVector3
(
1
,
1
,
1
));
// trimesh not needed any more
for
(
int
i
=
0
;
i
<
btHull
->
numVertices
();
i
++
)
delete
btTrimesh
;
{
return
btConvex
;
btConvex
->
addPoint
(
btHull
->
getVertexPointer
()[
i
]);
}
btConvex
->
setMargin
(
btMargin
);
// Trimesh no longer needed
btTrimesh
.
reset
();
return
btConvex
;
}
}
}
boost
::
shared_ptr
<
btRigidBody
>
BulletObject
::
getRigidBody
()
boost
::
shared_ptr
<
btRigidBody
>
BulletObject
::
getRigidBody
()
...
...
This diff is collapsed.
Click to expand it.
SimDynamics/DynamicsEngine/BulletEngine/BulletObject.h
+
2
−
1
View file @
bbcb7423
...
@@ -100,10 +100,11 @@ namespace SimDynamics
...
@@ -100,10 +100,11 @@ namespace SimDynamics
void
setPoseIntern
(
const
Eigen
::
Matrix4f
&
pose
);
void
setPoseIntern
(
const
Eigen
::
Matrix4f
&
pose
);
btCollisionShape
*
getShapeFromPrimitive
(
VirtualRobot
::
Primitive
::
PrimitivePtr
primitive
);
btCollisionShape
*
getShapeFromPrimitive
(
VirtualRobot
::
Primitive
::
PrimitivePtr
primitive
);
btCo
nvexHull
Shape
*
createConvexHullShape
(
VirtualRobot
::
TriMeshModelPtr
trimesh
);
btCo
llision
Shape
*
createConvexHullShape
(
VirtualRobot
::
TriMeshModelPtr
trimesh
);
boost
::
shared_ptr
<
btRigidBody
>
rigidBody
;
boost
::
shared_ptr
<
btRigidBody
>
rigidBody
;
boost
::
shared_ptr
<
btCollisionShape
>
collisionShape
;
// bullet collision shape
boost
::
shared_ptr
<
btCollisionShape
>
collisionShape
;
// bullet collision shape
std
::
unique_ptr
<
btTriangleMesh
>
btTrimesh
;
Eigen
::
Vector3f
com
;
// com offset of trimesh
Eigen
::
Vector3f
com
;
// com offset of trimesh
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment