Some Questions About it and a Bug.
-When i try to move around with Up,Left,Right,Down, There is some invisible object colliding with me. The ball slide around it but i dont know where is comming from.
-In the command Create3DPhysicsCharacterController it says, The ObjOffsetVec3 is half the amount , But when setting it at 50 (half of 100, offset in the Y direction), the ball
goes through the floor, stopping further down, when set at 0 it works ok, any idea or am i understanding it wrong?
-Also Adding x and z in Move3DPhysicsCharacterController just bugs the movement.
Here is the code , No external models needed :
// Project: Pruebas
// Created: 22-12-11
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Pruebas" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )
SetRawMouseVisible(0)
Box = CreateObjectBox(200,10,200)
Bola = CreateObjectSphere(20,20,20)
SetObjectPosition(Bola,0,100,0)
Vec3BolaOff = CreateVector3(0,0,0)
Vec3Bola = CreateVector3(0,100,0)
//Dynamic Bola
Create3DPhysicsWorld()
Create3DPhysicsDynamicBody(Bola)
SetObjectCollisionMode(Bola,1)
//Static Cube floor
Create3DPhysicsStaticBody(Box)
SetObjectCollisionMode(Box,1)
//Control Sphere with up,down,left,right
Create3DPhysicsCharacterController(Bola,1,Vec3BolaOff,Vec3Bola,20)
//Posisiones de la camera
CameraX = GetCameraAngleX(1)
CameraY = GetCameraY(1)
CameraZ = GetCameraZ(1)
do
//Move Ball
If GetRawKeyState(37) = 1
Move3DPhysicsCharacterController(Bola,3,100)
Elseif GetRawKeyState(38) = 1
Move3DPhysicsCharacterController(Bola,1,100)
Elseif GetRawKeyState(39) = 1
Move3DPhysicsCharacterController(Bola,4,100)
elseif GetRawKeyState(40) = 1
Move3DPhysicsCharacterController(Bola,2,100)
Else
Move3DPhysicsCharacterController(Bola,0,100)
Endif
//End Move Ball
if Getrawkeystate(87)=1
movecameralocalz(1,Speed#)
Elseif getrawkeystate(83)=1
movecameralocalZ(1,-Speed#)
endif
if Getrawkeystate(68)=1
movecameralocalX(1,Speed#)
Elseif getrawkeystate(65)=1
movecameralocalX(1,-Speed#)
endif
if getrawkeystate(27)=1
end
Endif
If GetRawKeyState(16) = 1
speed# = 3
Else
Speed# = 0.21
endif
myX# = getpointerX() - 512
myY# = getPointerY() - 384
xmove# = xmove# + (myX#)
ymove# = ymove# + (myY#)
If ymove# < - 800
ymove# = -800
endif
If ymove# > 800
ymove# = 800
endif
Setcamerarotation(1,ymove# / 16 , xmove# / 16, 0)
setrawmouseposition(512,384)
Print("CameraX = "+str(CameraX))
Print("CameraY = "+str(CameraY))
Print("CameraZ = "+str(CameraZ))
Print( ScreenFPS() )
Step3DPhysicsWorld()
Sync()
loop
Btw, Movements are just strafe left strafe right... how could i make them not be strafe?
And in the end of the code, How can i get the print command to update the camera position and print it so that i can position the camera more easy in the world instead of guessing.
many questions but its the nature of the thing, am having a hard time with physics and collisions and VECTors 3 just not working as expected FMPOV.
Thanks in advance ,
Animals