Hi
Long story for 12 euros :) ! Ok i'm trying to explain what
easytok do :
EasyTok is a library to help you to place easily your
physic under your game or app, direct in code or with 3DS max
But boiled, don't forget, that you have the code ! you can
modifiy all that you want to adapt Tokamak and EasyTOk for
your specific app :)
If you want use all tokamak functions and if your are a
Tokamak pro coder you don't need EasyTok :) !!!!
In EasyTok i have try to add only the functions more used !
Ok the example of the ball rolling ? hum ok :)
Cheers :)
PS : You say
"I'll tell you what I want to do : a basic scene, 2 small platforms at angles and drop bouncy balls on them so the balls bounce across the angles platforms and eventually fall down the hole.
Whats the best, easiest way to achieve this? Using EasyTok?"
Hum ! i think less than 5/10 lines (EasyTok) of code ? Happy ? :) You made you scene under 3DS Max :) And for the rest...
Long story for 12 euros :) ! Ok i'm trying to explain what
easytok do :
EasyTok is a library to help you to place easily your
physic under your game or app, direct in code or with 3DS max
But boiled, don't forget, that you have the code ! you can
modifiy all that you want to adapt Tokamak and EasyTOk for
your specific app :)
If you want use all tokamak functions and if your are a
Tokamak pro coder you don't need EasyTok :) !!!!
In EasyTok i have try to add only the functions more used !
Ok the example of the ball rolling ? hum ok :)
Cheers :)
PS : You say
"I'll tell you what I want to do : a basic scene, 2 small platforms at angles and drop bouncy balls on them so the balls bounce across the angles platforms and eventually fall down the hole.
Whats the best, easiest way to achieve this? Using EasyTok?"
Hum ! i think less than 5/10 lines (EasyTok) of code ? Happy ? :) You made you scene under 3DS Max :) And for the rest...
;======================================================================================= ; Code : EasyTok librarie example ; Project Title : EasyTok librarie example ; Author : Philippe Agnisola ; Email : ; Version : 1.0.0 ; Date : ; Notes : ; ; ;======================================================================================= Include "Inc_TimeMachine.bb" Include "Inc_EasyTOK.bb" ; ------------------------ ; Freelook cam var ; ------------------------ Global Mouse_X_Speed# Global Mouse_Y_Speed# Global Camera_VelX# Global Camera_VelZ# Global Camera_Pitch Global Camera_Yaw ; ------------------------------- ; Refresh frame number ; ------------------------------- Global AppFPS =60 ; ------------------ ; Open screen ; ------------------ Graphics3D 1024, 768,32 SetBuffer BackBuffer () ; ---------------------- ; Change font text ; ---------------------- AppFont=LoadFont("Arial",15,1,0,0) SetFont AppFont ; --------------------------------------- ; Setup camera and Easytok ; --------------------------------------- Global Cam=CreateCamera() PositionEntity Cam,0,20,-40 EntityRadius Cam,3 EntityType Cam,1 Proc_CreateVisor() TOK_InitWorld(0,-41,0,1000,100) ; ----------------------------- ; Creating demo world ; ----------------------------- Global Light1=CreateLight(2) PositionEntity Light1,-50,50,-50 LightColor Light1,200,100,50 LightRange Light1,90 Global Light2=CreateLight(2) PositionEntity Light2,50,50,50 LightColor Light2,50,200,50 LightRange Light2,90 AmbientLight 50,50,50 ; ---------------------------------------------------- ; Load the tokamak world from a B3D ; ---------------------------------------------------- TOK_CreatePhysicFromMesh(LoadAnimMesh("./ETOK_Medias/Simple_Scene01.b3d")) Collisions 1,2,2,3 ; ------------- ; Main loop ; ------------- FramePeriod = 1000 / AppFPS FrameTime = MilliSecs () - FramePeriod MoveMouse GraphicsWidth()/2, GraphicsHeight()/2 Global MyShootRate=200 Global MyShootTimer=TOK_CreateTimer( MyShootRate) Repeat ; -------------------------- ; Frame rate limiting ; -------------------------- Repeat FrameElapsed = MilliSecs () - FrameTime Until FrameElapsed FrameTicks = FrameElapsed / FramePeriod FrameTween# = Float (FrameElapsed Mod FramePeriod) / Float (FramePeriod) ; ----------------------- ; Update tweening ; ----------------------- For FrameLimit = 1 To FrameTicks If FrameLimit = FrameTicks Then CaptureWorld EndIf FrameTime = FrameTime + FramePeriod UpdateGame () UpdateWorld Next ; ------------------- ; Redraw world ; ------------------- TOK_RefreshEasyTOK() RenderWorld FrameTween ; ----------------------- ; FPS Displaying ; ----------------------- Proc_CinemaStrip() Color 255,255,255 Information$="<"+Get_FPS()+" FPS> / "+"<Arrow key to move> / <Mouse left to launch balls> / <Cam position : "+EntityX(Cam)+" / "+EntityY(Cam)+" / "+EntityZ(Cam)+">" Text GraphicsWidth()/2,GraphicsHeight()-30,Information$,True,True Flip Until KeyHit (1) ; ----------- ; End App ; ----------- TOK_FreePhysic() FreeFont AppFont End ; ----------------------------------- ; Tweening update function ; ----------------------------------- Function UpdateGame () Proc_Freelook(Cam,1.05,0.05) If MouseHit(1) Then Tmp$="Bullet"+Rnd(1000) TOK_CreateRBSphere(Tmp$,False,-73,84,32,0,0,0,3,60,"",Rnd(255),Rnd(255),Rnd(255),1,5) TOK_ApplyMaterial(Tmp$,TOK_TypeRigidBody%,"Ice") EndIf ; ----------------------------------------------------------- ; Define if the camera collide a toka object ; ----------------------------------------------------------- Local Power=100 If CountCollisions(Cam)>0 Then For k=1 To CountCollisions(cam) Entity_Collided=CollisionEntity(Cam,k) If TOK_IsRigidBody(Entity_Collided)=True Then TOK_ApplyImpulse2(TOK_GetRBName$(Entity_Collided),-Power*CollisionNX(Cam,k),-Power*CollisionNY(Cam,k),-Power*CollisionNZ(Cam,k),CollisionX(Cam,k),CollisionY(Cam,k),CollisionZ(Cam,k)) EndIf Next EndIf ; --------------------- ; Update physic ; --------------------- TOK_RefreshPhysic(1.7/AppFPS,5) End Function ; ----------------------- ; Create the visor ; ----------------------- Function Proc_CreateVisor() Visor=LoadSprite("./ETOK_Medias/Target.png") PositionEntity Visor,EntityX(Cam),EntityY(Cam),EntityZ(Cam)+2 ScaleSprite Visor,0.1,0.1 EntityParent Visor,Cam EntityOrder Visor,-1 End Function ; ---------------------------------- ; Create the cinema strip ; ---------------------------------- Function Proc_CinemaStrip(Size=60) Color 1,1,1 Rect 0,0,GraphicsWidth(),Size Rect 0,GraphicsHeight()-Size,GraphicsWidth(),Size End Function ; ---------------------- ; Camera freelook ; ---------------------- Function Proc_Freelook(CamEntity,Velocity#,Speed#) Mouse_X_Speed#=MouseXSpeed()*0.5 Mouse_Y_Speed#=MouseYSpeed()*0.5 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 Camera_Pitch=Camera_Pitch+Mouse_Y_Speed# Camera_Yaw=Camera_Yaw+Mouse_X_Speed# RotateEntity CamEntity,Camera_Pitch,-Camera_Yaw,0 If KeyDown(203) Then Camera_VelX=Camera_VelX-Speed# ElseIf KeyDown(205) Camera_VelX=Camera_VelX+Speed# EndIf If KeyDown(208) Then Camera_VelZ=Camera_VelZ-Speed# ElseIf KeyDown(200) Camera_VelZ=Camera_VelZ+Speed# EndIf Camera_VelX=Camera_VelX/velocity# Camera_VelZ=Camera_VelZ/velocity# MoveEntity CamEntity,Camera_VelX,0,Camera_VelZ If KeyDown(200) Then MoveEntity CamEntity,0,0,Speed# EndIf If KeyDown(208) Then MoveEntity CamEntity,0,0,-Speed# EndIf If KeyDown(205) Then MoveEntity CamEntity,Speed#,0,0 EndIf If KeyDown(203) Then MoveEntity CamEntity,-Speed#,0,0 EndIf End Function