Unfreeable shadow fragments.
Thorolf Tonjum <[email protected]>
| Newsgroups | gmane.comp.breve |
|---|---|
| Message-ID | <[email protected]> |
>From Thorolf Tonjum.
For some reason, freeing the object, does not take it completely away from the model,
as a result, the simulation becomes arbitary slow after 100 objects have been created and
destroyed.. sugesting shadow fragments of the original objects are still partisipating in the physics simulation
This is the object (its rather big..):
MultiBody : TripodTemplate {
+ variables:
bodyLink (object).
links (list).
Color1 (vector).
Color2 (vector).
joints (list).
+ to get-root:
return bodyLink.
+ to init:
linkShape, FootShape, SupportShape , lowerLinkShape, bodyShape (object).
self add-menu named "Send to Center" for-method "center".
SupportShape = new Shape.
SupportShape init-with-cube size (.16, 17, .16).
lowerLinkShape = new Shape.
lowerLinkShape init-with-cube size (.26, 1.5, .26).
linkShape = new Shape.
linkShape init-with-cube size (.28, 1.5, .28).
bodyShape = new Shape.
bodyShape init-with-polygon-disk radius (1.5) sides (8) height (0.2).
FootShape = new Shape.
FootShape init-with-polygon-disk radius (0.5) sides (8) height (0.2).
Color1 = random[(1.0, 1.0, 1.0)].
Color2 = random[(1.0, 1.0, 1.0)].
links = 12 new Links.
joints = 12 new RevoluteJoints.
links{0} set shape linkShape.
links{0} set-color to Color1.
links{2} set shape linkShape.
links{2} set-color to Color1.
links{4} set shape linkShape.
links{4} set-color to Color1.
links{1} set shape lowerLinkShape.
links{1} set-color to (1.0, 1.0, 1.0).
links{3} set shape lowerLinkShape.
links{3} set-color to (0.0, 1.0, 1.0).
links{5} set shape lowerLinkShape.
links{5} set-color to (1.0, 0.0, 1.0).
links{6} set shape SupportShape.
links{7} set shape SupportShape.
links{8} set shape FootShape.
links{9} set shape FootShape.
links{10} set shape FootShape.
links{11} set shape FootShape.
bodyLink = new Link.
bodyLink set shape bodyShape.
bodyLink set-color to Color2.
joints{6} set-relative-rotation around-axis (1, 0, 0) by 1.57 .
joints{6} link parent bodyLink to-child links{6}
with-normal ( 0, 1, 0 )
with-parent-point (0, 1.75, 0.0)
with-child-point (0, 0, 0).
joints{6} set-joint-limit-vectors min ( 1, 0, 0) max ( 1, 0, 0).
joints{8} set-relative-rotation around-axis (1, 0, 0) by 1.57 .
joints{8} link parent links{6} to-child links{8}
with-normal (-10, 0, 0)
with-parent-point (0, 7, 3.7)
with-child-point (0, 0, 0).
joints{10} set-relative-rotation around-axis (1, 0, 0) by 1.57 .
joints{10} link parent links{6} to-child links{10}
with-normal (-10, 0, 0)
with-parent-point (0, -7, 3.7)
with-child-point (0, 0, 0).
joints{7} set-relative-rotation around-axis (1, 0, 0) by 1.57 .
joints{7} set-relative-rotation around-axis (0, 0, 1) by 1.57 .
joints{7} link parent bodyLink to-child links{7}
with-normal ( 0, 1, 0 )
with-parent-point (0.0, 1.75, 0.0)
with-child-point (0, 0, 0).
joints{7} set-joint-limit-vectors min ( 1, 0, 0) max ( 1, 0, 0).
joints{9} set-relative-rotation around-axis (0, 0, 1) by 1.57 .
joints{9} link parent links{7} to-child links{9}
with-normal (-10, 0, 0)
with-parent-point (-3.7, 7, 0)
with-child-point (0, 0, 0).
joints{11} set-relative-rotation around-axis (0, 0, 1) by 1.57 .
joints{11} link parent links{7} to-child links{11}
with-normal (-10, 0, 0)
with-parent-point (-3.7, -7, 0)
with-child-point (0, 0, 0).
joints{0} link parent bodyLink to-child links{0}
with-normal ( 1.5, 0, 1 )
with-parent-point (0.85, 1, 0.65)
with-child-point (0, 2.2, 0).
joints{0} set-joint-limit-vectors min ( 0.8, 0, 0) max ( 1.3, 0, 0).
joints{1} link parent links{0} to-child links{1}
with-normal (-10, 0, 0)
with-parent-point (0, -.5, 0)
with-child-point (0, 1, 0).
joints{2} link parent bodyLink to-child links{2}
with-normal (-1.5, 0, 1)
with-parent-point (-0.85, 1, 0.65)
with-child-point (0, 2.2, 0).
joints{2} set-joint-limit-vectors min ( 0.8, 0, 0) max ( 1.3, 0, 0).
joints{3} link parent links{2} to-child links{3}
with-normal (-10, 0, 0)
with-parent-point (0, -.5, 0)
with-child-point (0, 1, 0).
joints{4} link parent bodyLink to-child links{4}
with-normal ( -1.5, 0, -1 )
with-parent-point (0, 1, -0.65)
with-child-point (0, 2.2, 0).
joints{4} set-joint-limit-vectors min ( 0.8, 0, 0) max ( 1.3, 0, 0).
joints{5} link parent links{4} to-child links{5}
with-normal (-10, 0, 0)
with-parent-point (0, -.5, 0)
with-child-point (0, 1, 0).
self register with-link bodyLink.
#self rotate around-axis (0, 1, 0) by 1.57.
joints set-double-spring with-strength 30 with-max 1.5 with-min -2 .
joints set-strength-limit to 40.
+ to Re-set:
self unregister.
# The following six methods allow external objects move the joints
+ to set-joint-velocity-1 to value (float):
joints{1} set-joint-velocity to value.
+ to set-joint-velocity-2 to value (float):
joints{2} set-joint-velocity to value.
+ to set-joint-velocity-3 to value (float):
joints{3} set-joint-velocity to value.
+ to set-joint-velocity-4 to value (float):
joints{4} set-joint-velocity to -value.
+ to set-joint-velocity-5 to value (float):
joints{5} set-joint-velocity to -value.
+ to set-joint-velocity-6 to value (float):
joints{0} set-joint-velocity to value.
+ to Re-set-shape:
joints{0} set-joint-velocity to 2.
joints{1} set-joint-velocity to 2.
joints{2} set-joint-velocity to 2.
joints{3} set-joint-velocity to 2.
joints{4} set-joint-velocity to 2.
joints{5} set-joint-velocity to 2.
+ to destroy:
free bodyLink.
free links{0} .
free links{2} .
free links{4} .
free links{1} .
free links{3} .
free links{5} .
free links{6} .
free links{7} .
free links{8} .
free links{9} .
free links{10} .
free links{11} .
free joints{0} .
free joints{1} .
free joints{2} .
free joints{3} .
free joints{4} .
free joints{5} .
free joints{6} .
free joints{7} .
free joints{8} .
free joints{9} .
free joints{10} .
free joints{11} .
# free self.
}
_______________________________________________
breve mailing list
[email protected]
http://www.spiderland.org/mailman/listinfo/breve