000
19.11.2000, 11:57
Tron
|
ich programmiere grade zur uebung eine einfache tuer, die sich auf beruehrung oeffnen soll.
wenn man sie beruehrt wird u.a. SetTouch(NULL) ausgefuehrt, das funktioniert aber nicht, da man die tuer auch weiterhin beruehren kann und die touch-methode meines entities auch weiterhin aufgerufen wird.
leider kenne ich mich mit static-casts nicht gut aus, hat irgendwer eine idee?
(die wichtigen stellen hab ich fett gemacht)
void CDoor :: Spawn()
{
Direction = Vector(1, 0, 0);
pev->solid = SOLID_BSP;
pev->movetype = MOVETYPE_PUSH;
UTIL_SetOrigin(pev, pev->origin);
SET_MODEL(ENT(pev), STRING(pev->model));
ClosePos = pev->origin;
float Length = Direction.Length();
OpenPos.x = ClosePos.x + (pev->size.x - 2) * Direction.x / Length;
OpenPos.y = ClosePos.y + (pev->size.y - 2) * Direction.y / Length;
OpenPos.z = ClosePos.z + (pev->size.z - 2) * Direction.z / Length;
LastPos = &OpenPos;
[b] SetTouch(Touch);[/b]
}
void CDoor :: Touch(CBaseEntity *pOther)
{
ALERT(at_console, "TOUCHING DOOR");
pev->nextthink = pev->ltime + (OpenPos - ClosePos).Length() / pev->speed;
SetThink(Stop);
pev->velocity = Direction.Normalize() * pev->speed;
[b] SetTouch(NULL);[/b]
}
void CDoor :: Stop()
{
pev->velocity.x = 0;
pev->velocity.y = 0;
pev->velocity.z = 0;
}
hallo? kann mir wirklich niemand bei meinem problem helfen? )-:
--
'KEINE PANIK' - aus der Triologie in fuenf Baenden von Douglas Adams
'FÜR DEINN FERD' - aus 'Gevatter Tod' von Terry Pratchett
|
|
Profil || Suche
|