entity passing through everything

Posted By: Denn15

entity passing through everything - 12/28/12 17:39

im moving an entity with c_move but the entity passes through everything. the world does not have the passable flag set

Code:
#include <default.c>
#include <acknex.h>

ENTITY* player_box;
var jump = 0;

function cam()
{
	while (1)
	{
		camera.x = player_box.x - 100;
		camera.z = 300;
		camera.y = 0;
		camera.tilt = -50;
		wait (1);
	}
}

function land()
{
	if (event_type == EVENT_BLOCK)
	{
		jump = 0;
	}
}
function shoot()
{
	while (1)
	{
		if (key_space)
		{
			jump = 20;
			while (1)
			{
				c_move (player_box, nullvector, vector(0, 0, jump*time_step), GLIDE);
				jump = jump - 0.2;
				if (event_type == EVENT_BLOCK){break;}
				wait(1);
			}
		}
		wait(1);
	}
}
action player_move()
{
	player_box = my;
	c_setminmax(my);
	my.emask |= ENABLE_BLOCK;
	my.event = land;
	cam();
	shoot();
	while (1)
	{
		c_move (my, nullvector, vector (1*time_step, 20*(key_a-key_d)*time_step, 0),GLIDE);
		wait (1);
	}
}
function main()
{
	level_load ("level.wmb");
}

Posted By: rayp

Re: entity passing through everything - 12/28/12 18:25

I had this problem too a few days ago. Try to compile the map as "BSP Map" ( not simple map ). If should work now, but dont ask why.

And i see a problem in your jumping script. Try to jump against a wall. Player stops falling down right ?
Posted By: Denn15

Re: entity passing through everything - 12/28/12 18:50

well ive tried to compile both a simple map and bsp map but nothing changes

and yea i know i havent got into how to make it only activate when it hits the ground.

another thing i noticed is that when running the script it loads all kind of weird dll files that it didnt do before like ackphysx.dll and ackwii.dll even though i use none of those
Posted By: rayp

Re: entity passing through everything - 12/28/12 18:54

sry then i cant help. I dont know what caused this strange behaviour.

edit: about the ground do something like that
Code:
var dist_z;
 var dist2ground = 0;
 dist2ground = c_trace(my.x, vector(my.x, my.y, my.z-1000)...USE_BOX
 if(dist2ground > 2 || dist2ground == 0){
   accelerate(dist_z, -2.5 * time_step, -1);
   }
 else dist_z = 0; // jumping over stand on something

..
 c_move(me....vector(.., .., dist_z...

Posted By: Denn15

Re: entity passing through everything - 01/01/13 13:07

i tried to simplyfy the script down to this

Code:
#include <acknex.h>
#include <default.c>

ENTITY* player_box;
var jump = 0;

function cam()
{
	while (1)
	{
		camera.x = player_box.x - 10;
		camera.z = 100;
		camera.y = player_box.y;
		camera.tilt = -50;
		wait (1);
	}
}

action my_car()
{
	player_box = my;
	cam();
	while (1)
	{
		c_move (my, nullvector, vector (1*time_step, 20*(key_a-key_d)*time_step, 0),GLIDE);
		wait (1);
	}
}
function main()
{
	level_load ("homework18.wmb");
}



and then copy the script to a one of the litec workshop project about moving entities where the previous script worked. however the new script makes the car go through everything again so i assume that is must be something with the script.
Posted By: Kartoffel

Re: entity passing through everything - 01/01/13 13:18

did you try the USE_POLYGON flag for c_move?
Posted By: Denn15

Re: entity passing through everything - 01/01/13 15:46

it still goes through smirk
Posted By: Superku

Re: entity passing through everything - 01/01/13 15:51

Is your model centered around the origin in MED?

Btw. a few screenshots and a demo would help a lot.
Posted By: Denn15

Re: entity passing through everything - 01/01/13 16:45

http://www.youtube.com/watch?v=8-Lr9VECmi4&feature=youtu.be

it is moved by c_move so it shouldnt move through. and yes the model is centered around the origin
Posted By: Kartoffel

Re: entity passing through everything - 01/01/13 19:16

It's a problem with your level or with your model.
I've created a simple map and tested it, the code is fine and works without problems.
Posted By: Det

Re: entity passing through everything - 01/01/13 19:45

If you set a hook at passable at Behavior in WED than the Enity goes trough walls ect. If there is no hook at passable the Enity goes not through walls.
Posted By: Denn15

Re: entity passing through everything - 01/01/13 19:51

none of the level has the passable flag set and ive tried with different maps but its the same.
when i copy the script to a project where c_move works it suddently doesnt work. and havent changed the models or anything only the script
Posted By: Superku

Re: entity passing through everything - 01/01/13 20:00

It's obviously not a script problem, you have to post a demo (script+model+level), otherwise it continues to be a guessing game.
Posted By: Denn15

Re: entity passing through everything - 01/01/13 20:07

http://www.sendspace.com/file/rubq5j

this script does not work for me. ive noticed that everytime i run a project it loads 4 dll's that it havent done from when i first got gamestudio. (ackphysx.dll, ackwii.dll, acknet.dll, ackAR.dll)
Posted By: Superku

Re: entity passing through everything - 01/01/13 20:34

The wmp is missing...
Posted By: Denn15

Re: entity passing through everything - 01/01/13 20:36

http://www.sendspace.com/file/rkz70v
Posted By: Superku

Re: entity passing through everything - 01/01/13 20:46

Rebuilding the level solved the problem, thus your map compiler settings must be wrong. Click "Default Settings" once and rebuild your level.
Posted By: Denn15

Re: entity passing through everything - 01/01/13 21:38

thanks you that solved the problem! laugh
© 2024 lite-C Forums