Stencil shadows are not displaying correctly on physics-enabled map entities. They show for a split second upon level load, but then immediately disappear. (If I comment out the 'sleep(2)' in the action shown below, the shadow does not show at all. The shadow disappears when the map entitiy is defined as a physics object.)

I have uploaded an example
that demonstrates the problem. The example contains two cylinder models that are casting stencil shadows onto a physics-enabled map entity and the other onto a physics-enabled model. The stencil shadows do not show up on the map entity (The marble block on the left). The stencil shadows show up correctly on the .mdl entity (the wood crate on the right). Both crates have the same action assigned to them. (The example has been updated to include the .wmp files.)

This is the code used in the example:

Code:

//defines
DEFINE mass,skill1;
DEFINE friction,skill2;
DEFINE damping,skill3;

//global vars
var d3d_nobsp = on;
var video_mode = 8;
var video_depth = 32; //16 bit color
var video_screen = 1; //full screen
var d3d_alphadepth=32;
var d3d_shadowdepth=24;
var d3d_lightres=on;

var clip_size=0;
var turb_speed = .1;
var shadow_range = 50;
var shadow_stencil=on;

var cam_dist = 500; //camera distance from the origin

//physics globals
var gravity[3] = 0,0,-1000;


function main()
{

camera.clip_near = 15;
camera.clip_far = 100000;

level_load("stencil_test.wmb");
sleep(1);

//initialize physics
ph_setgravity(gravity);
ph_setcorrections(40000,0.001);

camera.tilt=-45;
camera.pan = 165;
camera.x = 150;
camera.y = 150;
camera.z = 400;

while(1)
{

camera.pan-=mouse_force.x;
//camera.tilt+=mouse_force.y;

//camera.x=cos(camera.pan)*(cam_dist*cos(camera.tilt));
//camera.y=sin(camera.pan)*(cam_dist*cos(camera.tilt));

//vec_to_angle(camera.pan,nullvector);
wait(1);
}
}


//uses mass,mass,Obstacle_damping
action Pushable_block
{
if (my.mass<1){my.mass=10;}
if (my.friction<1){my.friction=50;}
if (my.damping<1){my.damping=90;}
sleep(2);
my.shadow = on;
phent_settype(my,PH_RIGID,PH_BOX);
phent_setgroup(my,1);
phent_setmass(my,my.mass,PH_BOX);
phent_setfriction(my,my.friction);
phent_setelasticity(my,10,10);
phent_setdamping(my,my.damping,my.damping);

}




Gamestudio Pro 6.31.3



Jason