Crystal Space
Welcome, Guest. Please login or register.
November 19, 2017, 10:31:39 pm

Login with username, password and session length
Search:     Advanced search
9081 Posts in 2051 Topics by 80472 Members
Latest Member: Markdotolo2564
* Home Help Search Login Register
  Show Posts
Pages: 1 ... 3 4 [5]
61  Crystal Space Development / Support / Re: Collision Detection - What's going wrong here? on: July 11, 2005, 07:41:30 pm
Ok. So, next step is:

How do I create the player Bounding Box using something turnable in an iMeshWrapper?

62  Crystal Space Development / Support / Re: Collision Detection - What's going wrong here? on: July 04, 2005, 10:23:06 pm
Well... Because I want to move the player's Bounding Box... Is there any way?
63  Crystal Space Development / Support / Collision Detection - What's going wrong here? on: June 18, 2005, 12:43:52 am
Well, I researched a little, and the only function that I found that specifically moves an mesh is implemented in class iMovable.

My question now is, how can I reach an iMovable object from an iCollider (or an csPolygonMeshBox)Huh I didn't see any connections between these two...

Thanks in advance
64  Crystal Space Development / Support / Collision Detection - What's going wrong here? on: June 07, 2005, 02:00:00 pm
Ok. That was what I was suspecting. But, now in a practical way, how should I do it? I have searched a little through the CS's API Reference, but I haven't found nothing yet.

And can you give me an quick description-how-to-use-little-tour of CEL?

65  Crystal Space Development / Support / Collision Detection - What's going wrong here? on: June 06, 2005, 02:53:52 pm

Although there are some views of the topic, nobody answered it. But I will update my progress so far anyway.

Well, the function Collide() returned true one time, when I changed the csPolygonMeshBox() parameters, as you'll see below:


csPolygonMeshBox* box = new csPolygonMeshBox(csBox3(csVector3(-1, -1, -1), csVector3(1, 1, 1)));

Testing my app with the partsys map, the camera got stuck in the ground. (The start position is a little over the ground. So, the polygon is cutting the player's box in a half, and then, only then, I got a collision.

But when I load another map that I do not start inside a polygon, I have no collision at all.

I thinked a little, and I want some clearness in this stuff. When I move the camera, the collider that I've created moves too?

66  Crystal Space Development / Game Content Creation / Portals in maps created in 3DMax on: June 06, 2005, 02:45:26 pm
Just for mention:

I've discovered that the answer is yes.

In the Exporter Guide was all the explanation. Just name your polygon beginning with "_p_" and all set. (If you want a warping portal, you'll have to set some properties.)
67  Crystal Space Development / Support / Collision Detection - What's going wrong here? on: June 02, 2005, 03:11:29 pm
And I forgot! The problem is the line:

if (cd_sys->Collide(collide_wrap->GetCollider(), &mesh_trans, player_collider, &cam_trans))

The Collide() finction always returns false, even if the player is inside the polygon! I don know what I can do...
68  Crystal Space Development / Support / Collision Detection - What's going wrong here? on: June 02, 2005, 02:56:53 pm
Hello all;

I having some troubles about doing collision detection. My code was based in the Maze Tutorial in Crystal Space, but, I don't know why, it's just do not collide! The source code, mazetut.cpp, works fine, but uses a different approach in movement with collisions. I, for now, have a more simple view. If the player collides in something, he just can't move. Thatś why the amount that the camera moves is atomic (or minimal).

Well, I'll show here my collision detection code:

Player::Player(ERD *erd) // Player Constructor
Player::erd = erd;

Player::~Player() //Player Destructor

bool Player::InitCollider() // Instatiate player collider mesh
// Create the Bounding Box for the Player
csPolygonMeshBox* box = new csPolygonMeshBox(csBox3(csVector3(1, -0.5, -0.5), csVector3(-1, 5, 0.5)));

//Create Player's Collider
player_collider = erd->GetCollisionDetectionSystem()->CreateCollider(box);
player_radius = 2; //In fact, the player's max radius is 1.0, but it is just for safety.

//Derreferences object 'box'

if (!player_collider)
return false;
return true;

bool Player::CanMove(const csVector3 &direction, float speed) // Detects collision in movement
//Get the camera and the transformation matrix
iCamera* cam = erd->GetView()->GetCamera();
csReversibleTransform cam_trans = cam->GetTransform();

//Get all nearby meshes that can possibly collide
csRef<iMeshWrapperIterator> it = erd->GetEngine()->GetNearbyMeshes(
cam->GetSector(), direction, player_radius + speed, true);

if (it->HasNext()) //We have nearby meshes... Collision is possible
iCollideSystem *cd_sys = erd->GetCollisionDetectionSystem();

it->Reset(); //Just for sure ;-)

while (it->HasNext())
iMeshWrapper* mesh = it->Next();
csColliderWrapper* collide_wrap = csColliderWrapper::GetColliderWrapper (mesh->QueryObject ());
if (collide_wrap)
csReversibleTransform mesh_trans = mesh->GetMovable()->GetFullTransform();
cd_sys->ResetCollisionPairs(); //New collisions - Avoid continuous grow of the collision table
if (cd_sys->Collide(collide_wrap->GetCollider(), &mesh_trans, player_collider, &cam_trans))
//We have a collision! So the character can not move to the point
return false;

//No collisions at all... Movement is possible.
return true;

And here is how the camera moves:

if (erd->kbd->GetKeyState('d'))
if (player->CanMove(CS_VEC_RIGHT * 4 * speed, 4 * speed))
c->Move(CS_VEC_RIGHT * 4 * speed);
if (erd->kbd->GetKeyState('a'))
if (player->CanMove(CS_VEC_LEFT * 4 * speed, 4 * speed))
c->Move(CS_VEC_LEFT * 4 * speed);
if (erd->kbd->GetKeyState('w'))
if (player->CanMove(CS_VEC_FORWARD * 4 * speed, 4 * speed))
c->Move(CS_VEC_FORWARD * 4 * speed);
if (erd->kbd->GetKeyState('s'))
if (player->CanMove(CS_VEC_BACKWARD * 4 * speed, 4 * speed))
c->Move(CS_VEC_BACKWARD * 4 * speed);

I appreciate any help.

69  Crystal Space Development / Game Content Creation / Portals in maps created in 3DMax on: May 19, 2005, 03:48:53 pm
Is there any other way to use portals in maps created in 3DMax without editing the XML file?? 3D gives support for portals???

Thx in advance...
70  Crystal Space Development / General Crystal Space Discussion / Map from 3ds Max on: May 19, 2005, 03:45:57 pm
Yes, you can.

Use the scripts found in $CRYSTAL/scripts/max/ . Hhow to install them in 3D and how to use them, just head to the tutorial in $CRYSTAL/scripts/max/exporterguide/index.htm .

It's a little tricky to use it at 3DMax 7. But in lower version it should work fine...
71  Crystal Space Development / Support / Mouselook on: April 18, 2005, 02:17:53 pm
Hi to all;

I'm trying to implement mouselook in an app, and I taked the walktest code as template. But I know that walktest isn't the best choice for templating, but I didn't find (and didn't looked hard either) for other samples on coding. My questions are:

1) How to implement smooth mouse look in CS?

2) How to vanish with the mouse pointer, as walktest does when you toggle freelook?

My actual code was something like that (the commented part was mine previous implementation, the new one I just copied from Walktest with few modifications), based also in the simple2 tutorial. The result? A freakin' spinning' all-directions screen... It only stops a little when I move the mouse...

In the drawing function:

//Camera Rotation via Matrix Transformation - Mouse Look
if (rotX || rotY) //The mouse moved
csMatrix3 rot = view->GetCamera()->GetTransform().GetO2T();
if (rotX)
rot *= csXRotMatrix3(rotX);
if (rotY)
rot *= csYRotMatrix3(rotY);
csOrthoTransform ot(rot, c->GetTransform().GetOrigin());
rotX = 0.0;
rotY = 0.0;

In the event handling function:
case csevMouseMove:
iGraphics2D* g2d = g3d->GetDriver2D();
/* int x_deslocation = ev.Mouse.x - (FRAME_WIDTH / 2);
int y_deslocation = ev.Mouse.y - (FRAME_HEIGHT / 2);
g2d->SetMousePosition (FRAME_WIDTH / 2, FRAME_HEIGHT / 2);
rotX = (float) x_deslocation/(FRAME_WIDTH);
rotY = (float) (y_deslocation/FRAME_HEIGHT);
return true;
static bool first_time = true;
int last_x, last_y;
last_x = ev.Mouse.x;
last_y = ev.Mouse.y;

g2d->SetMousePosition (FRAME_WIDTH / 2, FRAME_HEIGHT / 2);
if (!first_time)
rotY = ((float)(last_y - (FRAME_HEIGHT / 2) )) / (FRAME_HEIGHT*2);
rotX = ((float)(last_x - (FRAME_WIDTH / 2) )) / (FRAME_WIDTH*2);
first_time = false;
return true;

Thanks in advance.
72  Crystal Space Development / Support / Map Creating in XML on: April 05, 2005, 03:39:10 pm
How to generate coordinate independent sectors?

I want that two sectors have an origin in (0.0,0.0,0.0) but the mustn't be overlapped.

I made a sector that is a corridor that ends in a portal that leads to the middle of other sector, which is an spiral. The end of this spiral  have another portal that leads into this corridor again. And then goes on and on and on and on and on.. .... ....  wink

Well, my problem is that the two sectors have the same origin, at (0.0 x3). and I thought that the sectors had independent coordinate systems. Is there any way to do this??

It's quite urgent.

Thx in advance
73  Crystal Space Development / Support / csInitializer::SetupEventHandler() on: March 21, 2005, 01:30:14 pm
Thanks for your help! But I coudn't understand what do you meant with that g_pApp pointer. Would I set it to what?

And, for code organization, I want to place the Event Handler in another class apart of the main one (ERD).

Is the StaticEventHandler() just a security function just for pass by the compiler?

Anyway, thanks for your help.

74  Crystal Space Development / Support / csInitializer::SetupEventHandler() on: March 18, 2005, 04:07:56 pm
Hello all;

I rather new in using CS, but we're on an project that will use it's libraries.

But I have an problem. I'm not a experienced programmer in C++, my experience resumes in C (so, no Object Oriented... wink ). And I having this function slowing my progress in development, so i would reaaly appreciate some help.

here is the function call and definitions:

bool ERD::EventHandler (iEvent& ev)
return event->HandleEvent(ev);

/* Initialize */
bool ERD::Initialize ()
event = new Event();

// Initialize Event Handler
if (!csInitializer::SetupEventHandler(object_reg,  erd->EventHandler))
csReport(object_reg, CS_REPORTER_SEVERITY_ERROR,
"Estrada Real Digital",
"Erro ao inicializar o Event Handler!");
return false;
bool Event::HandleEvent(iEvent &ev)

And the makefile output:

g++  -I/crystalspace/CS/include      -o teste.o -c teste.cpp
teste.cpp: In member function `bool ERD::Initialize()':
teste.cpp:160: error: no matching function for call to `csInitializer::SetupEventHandler(iObjectRegistry*&, <unknown type>)'
/crystalspace/CS/include/cstool/initapp.h:340: note: candidates are: static bool csInitializer::SetupEventHandler(iObjectRegistry*, iEventHandler*, unsigned int)
/crystalspace/CS/include/cstool/initapp.h:360: note:                 static bool csInitializer::SetupEventHandler(iObjectRegistry*, bool (*)(iEvent&), unsigned int)
make: *** [teste.o] Error 1

I've already tried a lot of thigs to get this thing on, but I failed in all. If someone could lend me some help, I would be gratefull.

Thanks in advance.

P.S. - My system features:

sisifo:~->uname -a
Linux sisifo 2.6.10-1.766_FC3smp #1 SMP Wed Feb 9 23:21:37 EST 2005 i686 i686 i386 GNU/Linux
sisifo:~->gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)
Pages: 1 ... 3 4 [5]
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 5.226 seconds with 16 queries.