Kollisionen mit schiefer Ebene gehen nicht richtig
Übersicht

coldieBetreff: Kollisionen mit schiefer Ebene gehen nicht richtig |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
hi,
Die Kollisionen mit schiefen Ebenen funktionieren bei mir nicht. Könnte es vll. am mesh liegen, oder an den Längenenheiten (1cm = 1Längeneinheit)? Ohne schwerkraft geht es auch nicht. Was kann man da machen? Code: [AUSKLAPPEN] Global movx = 0 Global movz = 0 Global screenX = 1280 Global screenY = 1024 Graphics3D screenX,screenY,32,1 SetBuffer BackBuffer() light = CreateLight() TurnEntity light,-60,40,0 Global campiv = CreatePivot() Global camera = CreateCamera(campiv) CameraRange camera,1,100000000 EntityType campiv,Body EntityRadius campiv,60 Const Body=1,SCENE=2 Collisions Body,SCENE,2,2 Global treppcoll = LoadMesh("treppcoll.b3d",trepph) trepptex = LoadTexture("treppcoll.jpg") EntityTexture treppcoll,trepptex EntityType treppcoll,scene PositionEntity campiv,260000,500,249300 PositionEntity treppcoll,260000,500,249500 ;------------------------------------------------------------------------------------------------------- ;----------------------------------------------HAUPTSCHLEIFE-------------------------------------------- While Not KeyHit(1) movx = 0 movz = 0 MouseControlsPS1() keycontrolsPS1() If EntityCollided(campiv,scene) kollision=1 MoveEntity campiv,0.01*movx,0,0.01*movz Else kollision=0 TranslateEntity campiv,0,-5,0 EndIf UpdateWorld RenderWorld Text 0,20,"Koordinaten Campiv: X: "+EntityX(campiv)+" Y: "+EntityY(campiv)+" Z: "+EntityZ(campiv)+" Camera : X: "+EntityX(camera)+" Y: "+EntityY(camera)+" Z: "+EntityZ(camera) Text 0,40,"Kollision: "+kollision If CountCollisions(campiv)>0 Text 0,50,"Entity="+CollisionEntity(Campiv,1)+" NX="+CollisionNX(Campiv,1)+" NY="+CollisionNY(Campiv,1)+" NZ="+CollisionNZ(Campiv,1) EndIf Flip Wend End Function MouseControlsPS1() iX = MouseXSpeed() * 0.25 iY = MouseYSpeed() * 0.25 MoveMouse ScreenY / 2, ScreenX / 2 iPitch = iPitch + iY iYaw = iYaw - iX RotateEntity camera,EntityPitch(camera)+iPitch,EntityYaw(camera),0 RotateEntity campiv,EntityPitch(campiv),EntityYaw(campiv)+iYaw,0 End Function Function keycontrolsPS1() If KeyHit(57) MoveEntity campiv,0,120,0 EndIf If KeyDown(17) movz=140 EndIf If KeyDown(31) movz=-140 EndIf If KeyDown(30) movx=-140 EndIf If KeyDown(32) movx=140 EndIf End Function komplett mit mesh: http://cwsim.cw.funpic.de/collision.rar[ |
||
![]() |
Cat |
![]() Antworten mit Zitat ![]() |
---|---|---|
also bei mir funktioniert die kollision mit der schiefen ebene, willst du einfach nur das die kamera stoppt wenn sie mit der ebene kollidiert oder möchtest du dich auf ihr bewegen können?
mfg |
||
Intel Core 2 Duo E6300 (2 x 1,86 Ghz)
2 x 1024 MB Arbeitsspeicher NVidia GeForce 8800 GT |
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Das ist ja der kollisionsmesh von einem Treppenhaus (schlecht zu erkennen, weil man nach oben hin die treppe nicht mehr sieht, da die backfaces unsichtbar sind). Man soll bis nach oben laufen können.
Das Problem (bei mir zumindest) äußert sich genauer gesagt darin, dass man sobalt man die schiefe Ebene (die Treppenstufen) berührt stoppt. Wenn man weitergehen will fällt man irgendwann durch die Ebene durch. Das runtergehen bei der schiefen Ebene geht ja einigermaßen. sry wenn nicht schon aus dem ersten Post ersichtlich war, was genau Sache ist ![]() |
||
![]() |
Cat |
![]() Antworten mit Zitat ![]() |
---|---|---|
du musst bei
Code: [AUSKLAPPEN] If EntityCollided(campiv,scene)
kollision=1 MoveEntity campiv,0.01*movx,0,0.01*movz die Y-Verschiebung bei MoveEntity auf 1 setzen da sich der Pivot ja nach oben bewegen soll wenn er mit der Treppe kollidiert, also: Code: [AUSKLAPPEN] If EntityCollided(campiv,scene)
kollision=1 MoveEntity campiv,0.01*movx,1,1.01*movz dann sollte es klappen ![]() lg |
||
Intel Core 2 Duo E6300 (2 x 1,86 Ghz)
2 x 1024 MB Arbeitsspeicher NVidia GeForce 8800 GT |
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
naja es geht dann zwar ein bisschen besser, aber ich komm immer noch nicht die treppe hoch.
Das komische ist ja auch, dass man doch im prinzip dasselbe bei einem terrain auch hat (schiefe ebene) aber bei terrain hatte ich noch nie probleme. |
||
![]() |
Cat |
![]() Antworten mit Zitat ![]() |
---|---|---|
sorry hatte was vergessen, du musst noch bei
Code: [AUSKLAPPEN] Collisions Body,SCENE,2,2
die Reaktion auf 3 stellen das der Pivot hinaufslidet ![]() hoffe es klappt jetzt lg |
||
Intel Core 2 Duo E6300 (2 x 1,86 Ghz)
2 x 1024 MB Arbeitsspeicher NVidia GeForce 8800 GT |
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Danke!
Es ist zwar immer noch nicht perfekt aber wenigstens funktionierts jetzt halbwegs. Da kann man ja noch dran rumtüfteln. |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group