Re: Odd behavior of 'cube'
James M Grimes <[email protected]> Thu, 9 Dec 2004 16:48:43 -0800
| Newsgroups | gmane.comp.breve |
|---|---|
| Message-ID | <[email protected]> |
Hi Jon,
Thanks for the great software, by the way!
Here's an example I cooked up specifically to test the situation. You
will probably recognize some of the code from the demos. The behavior
of the balls on the negative X axis is kind of odd, because the +X
balls come through and interact with them. Gives me kind of an
understanding of their underlying physics. All very interesting!
If you have questions running the demo please ask away.
Thanks again,
Jim Grimes
# test of cube object for +x bug
# The red axis points toward +X direction, but the three axes don't
start at 0,0,0
#
# get-rgb-color for-hsv-color hsvColor (vector)
@use PhysicalControl.
@use Mobile.
@use Terrain.
@use Stationary.
Controller TestRect.
PhysicalControl : TestRect {
+ variables:
ball, testbox (object).
xaxis, yaxis, zaxis (object).
+ to init:
# works: self set-background-texture-image to (new Image load
from "images/clouds.png").
# doesn't work: self set-background-texture-image to (new Image
load from "images/stars.png").
self zero-gravity.
self enable-shadow-volumes.
testbox = new Stationary.
testbox register with-shape (new Cube init-with size (10.0,
10.0, 10.0))
at-location (0.0, 0.0, 0.0) .
xaxis = new Stationary.
yaxis = new Stationary.
zaxis = new Stationary.
xaxis register with-shape (new Cube init-with size (100.0, .5,
.5))
at-location (60.0, 10.0, 10.0)
.
yaxis register with-shape (new Cube init-with size (.5, 100.0,
.5))
at-location (10.0, 60.0, 10.0)
.
zaxis register with-shape (new Cube init-with size (.5, .5,
100.0))
at-location (10.0, 10.0, 60.0)
.
xaxis set-color to (1.0, 0.0, 0.0) .
yaxis set-color to (0.0, 1.0, 0.0) .
zaxis set-color to (0.0, 0.0, 1.0) .
self point-camera at (0, 0, 0) from (80.0, 50.0, 200.0).
self enable-lighting.
# self set-z-clip to (1000.0).
self move-light to (0, 33, 25).
+ to iterate:
if random[100] < 1: self shoot-ball.
super iterate.
+ to shoot-ball:
ball = new Ball.
}
Mobile : Ball {
+ variables:
loc, vel (vector).
r (float).
hue (float).
which (int).
+ to init:
which = random [5] .
if which == 0: { loc = (0, -30, 0) . vel = (0, 2, 0) . }
else if which == 1: { loc = (30, 0, 0) . vel = (-2, 0, 0) . }
else if which == 2: { loc = (-30, 0, 0) . vel = (2, 0, 0) . }
else if which == 3: { loc = (0, 0, 30) . vel = (0, 0, -2) . }
else if which == 4: { loc = (0, 0, -30) . vel = (0, 0, 2) . }
else { loc = (0, 30, 0) . vel = (0 , -2, 0) . }
r = 2.0 .
self set-shape to (new Sphere init-with radius r).
hue = random[360.0] .
self set-color to (controller get-rgb-color for-hsv-color (hue,
1.0, 1.0)) .
self move to loc.
self set-velocity to vel.
self enable-physics.
+ to iterate:
self set-velocity to vel.
if (self get-age) > 50: free self.
else { if dot((0,1,0), (self get-location)) < -60: free self. }
}
On Thursday, December 9, 2004, at 04:07 PM, jon klein wrote:
>
> On Dec 8, 2004, at 7:10 PM, James M Grimes wrote:
>
>> I've noticed that a Stationary object registered with a cube has the
>> peculiar property that Mobile objects impinging on its positive-x
>> side can embed themselves in the Stationary object. If the Mobile
>> object is small enough, it will go right on through the Stationary
>> cube.
>>
>> To me this seems odd, but maybe it's a desired behavior. Or maybe
>> that positive-x side has been defined in the wrong direction, in
>> which case it's likely the same for all cube objects, Stationary or
>> Mobile.
>>
>> So, does anyone know about more about this? I can send along a quick
>> test program if anyone's interested.
>
> Hi Jim,
> if I'm understanding the problem correctly, it does sound like a bug!
> If you can provide me with a test simulation, I can confirm and fix
> it. I tend to use Stationaries as "ground" objects (as in the demos),
> so the collisions are usually happening on the +Y face -- so a +X face
> bug might have gone unnoticed.
>
> Thanks,
>
> - jon klein
>
> _______________________________________________
> breve mailing list
> [email protected]
> http://lists.spiderland.org/mailman/listinfo/breve
>
_______________________________________________
breve mailing list
[email protected]
http://lists.spiderland.org/mailman/listinfo/breve