Show Posts
|
|
Pages: [1] 2
|
|
2
|
Crystal Space Development / Game Content Creation / detecting hits
|
on: February 03, 2006, 06:13:24 pm
|
|
I'm new at gamedev so this is a newbie question.
In a FPS, an enemy fires a weapon at the player and the player is hit. How is this detected? Is this through collision detection? I want to add a specific sound when the shot hits the player v/s when it misses.
Thanks in advance.
|
|
|
|
|
4
|
Crystal Space Development / Game Content Creation / Re: attaching weapons to camera
|
on: January 24, 2006, 04:37:13 pm
|
|
Ok, I got that working. The issue is that the weapon keeps getting clipped off with a little bit of camera movement. E.g, after rotating right the weapon gets clipped off and re-appears when I rotate left. Same this happens when rotating left and moving forward. The weapon remains in view when the camera is moved backwards. The center-point of the weapon is set to the center-point of the camera. What could be causing this? Here is the relevant code:
void Test::ProcessFrame() { csTicks elapsedTime = vc->GetElapsedTicks(); float speed = (elapsedTime / 1000.0f);
iCamera* camera = view->GetCamera(); iMovable* movable = weapon->GetMovable();
if (kbd->GetKeyState(CSKEY_RIGHT)) { camera->GetTransform().RotateThis(CS_VEC_ROT_RIGHT, speed); movable->GetTransform().RotateThis(CS_VEC_ROT_RIGHT, speed); } if (kbd->GetKeyState(CSKEY_LEFT)) { camera->GetTransform().RotateThis(CS_VEC_ROT_LEFT, speed); movable->GetTransform().RotateThis(CS_VEC_ROT_LEFT, speed); } if (kbd->GetKeyState(CSKEY_PGUP)) { camera->GetTransform().RotateThis(CS_VEC_TILT_UP, speed); movable->GetTransform().RotateThis(CS_VEC_TILT_UP, speed); } if (kbd->GetKeyState(CSKEY_PGDN)) { camera->GetTransform().RotateThis(CS_VEC_TILT_DOWN, speed); movable->GetTransform().RotateThis(CS_VEC_TILT_DOWN, speed); } if (kbd->GetKeyState(CSKEY_UP)) { camera->Move(CS_VEC_FORWARD * 4 * speed); } if (kbd->GetKeyState(CSKEY_DOWN)) { camera->Move(CS_VEC_BACKWARD * 4 * speed); }
// position the weapon relative to the camera position movable->SetPosition(camera->GetTransform().GetO2TTranslation());
if (!g3d->BeginDraw(engine->GetBeginDrawFlags() | CSDRAW_3DGRAPHICS)) return;
view->Draw(); }
|
|
|
|
|
6
|
Crystal Space Development / Game Content Creation / Re: blender to cs
|
on: January 22, 2006, 09:10:38 pm
|
Hmmm, also having troubles with blender 2.4 ... Which version of python and 4suite did you take to get it running?
Version 2.3 of python and the lastest version of 4suite (4Suite-1.0a3-py23-win32.exe) I think that for Blender 2.4 you need Python 2.4 Greetings, Sorry. I should have mentioned that I reverted to version 2.37a of blender.
|
|
|
|
|
8
|
Crystal Space Development / Game Content Creation / Re: blender to cs
|
on: January 21, 2006, 10:56:30 pm
|
Yes, the scripts were installed in .blender/scripts/ Doing the same thing for 2.37a worked. I don't know... I just got blender2crystal to work with Blender 2.4. Are you sure you originally installed the scripts in the correct location?
|
|
|
|
|
12
|
Crystal Space Development / Game Content Creation / Re: blender to cs
|
on: January 13, 2006, 05:03:07 am
|
OK - I installed python, 4suite, PIL, and blender2crystal as documented in that page. I get the File->Export->CrystalSpace menuitem too. When I click on it, blender dies.  Has anyone experienced seen this? What do I do to get over this one? Thanks!
|
|
|
|
|
15
|
Crystal Space Development / Support / Re: Loading sprites from mapfiles
|
on: December 31, 2005, 07:38:07 am
|
|
Thanks Jorrit!
That makes sense as to why sprites come up as nodes.
In any case, I was able to use the node, childobject, and key-value pair functionality to get the sprite to display as I wanted.
In case anyone is interested, here is what I've done:
Added custom attributes to the sprite entity. These are spriteTextureName, spriteTextureFile and spriteFactoryFile. I then set the value of each attribute. This was in Hammer.
In my C++ code, I obtained a pointer to the iMapNode and obtained child objects corresponding to each custom attribute. For each attribute I then obtained the key-value pair, extracted the value and loaded the texture and mesh-factory that I'd specified in Hammer. The sprite displays just fine. Here's the relevant code-snippet (still WIP)
bool WaterPlay::DisplaySprite(iSector* sector, const char* spriteName) { iMapNode* node = csMapNode::GetNode(sector, spriteName); if (!node) { csString msg("Unable to load sprite: "); return ReportError(msg + spriteName); }
// get the required attributes csRef<iObject> o_txNameAttr = node->QueryObject()->GetChild("spriteTextureName"); if (!o_txNameAttr) { csString msg("No spriteTextureName attribute for sprite: "); return ReportError(msg + spriteName); } csRef<iKeyValuePair> txNameAttr(SCF_QUERY_INTERFACE(o_txNameAttr, iKeyValuePair));
csRef<iObject> o_txFileAttr = node->QueryObject()->GetChild("spriteTextureFile"); if (!o_txFileAttr) { csString msg("No spriteTextureFile attribute for sprite: "); return ReportError(msg + spriteName); } csRef<iKeyValuePair> txFileAttr(SCF_QUERY_INTERFACE(o_txFileAttr, iKeyValuePair));
csRef<iObject> o_factFileAttr = node->QueryObject()->GetChild("spriteFactoryFile"); if (!o_factFileAttr) { csString msg("No spriteFactoryFile attribute for sprite: "); return ReportError(msg + spriteName); } csRef<iKeyValuePair> factFileAttr(SCF_QUERY_INTERFACE(o_factFileAttr, iKeyValuePair));
// load the specified texture iTextureManager* txMgr = g3d->GetTextureManager(); iTextureWrapper* txWrp = loader->LoadTexture(txNameAttr->GetValue(), txFileAttr->GetValue(), CS_TEXTURE_3D, txMgr, true); if (!txWrp) { csString msg("Unable to load texture for sprite: "); return ReportError(msg + spriteName); }
// load the sprite template csRef<iMeshFactoryWrapper> meshFact(loader->LoadMeshObjectFactory( factFileAttr->GetValue())); if (!meshFact) { csString msg("Unable to load mesh-factory for sprite: "); return ReportError(msg + spriteName); }
// add the sprite to the engine csRef<iMeshWrapper> sprite(engine->CreateMeshWrapper( meshFact, spriteName, sector, node->GetPosition()));
sprite->SetZBufMode(CS_ZBUF_USE); sprite->SetRenderPriority(engine->GetObjectRenderPriority());
csRef<iSprite3DState> spriteState(SCF_QUERY_INTERFACE( sprite->GetMeshObject(), iSprite3DState)); spriteState->SetAction("default"); return true; }
|
|
|
|
|
|