EasyTOK version 1.1

Blitz3D Forums/Blitz3D Programming/EasyTOK version 1.1

Filax(Posted 2006) [#1]
Previous topic:
http://www.blitzbasic.com/Community/posts.php?topic=53535

Hi :)

Alleluia :) Tokamak physic with blitz terrain is ready :)

You will find a procedure to make it easy (as alway) and
with one line of code you setup a blitz terrain with physic !

RELEASE COMING SOON ! BUT FOR THE MOMENT I'M IN DEBUG MODE

I will release a demo very soon !

Version 1.1 :
-------------
New example : 'Beginning - Ship 01.bb' To see how create a space ship with flight and breakable part !
New example : 'Beginning - Ragdoll 3DS 01.bbb' To see how create a ragdoll directly under max !

Documentation : Error removed under '3D integration".
Documentation : Doc in CHM format.

New function : Joints can have a life parameter !!

New function : Proc_CreatePhysicFromBlitzTerrain(Heightmap$,Colormap$,DetailMap$,ShadowMap$,ScaleXZ,ScaleY)
Look the example : Confirmed - Terrain Physic 01.bb

You can now define physic with blitz terrain










Avon(Posted 2006) [#2]
WOO HOO!!! I only purchased EasyTOK 1.0 yesterday, this is a great addition.

Many thanks Filax!


Filax(Posted 2006) [#3]
Download demo : With blitz terrain physic
http://www.blitz3dfr.com/phpfrench/request.php?31


EmerGki(Posted 2006) [#4]
I want to know how I must to do my character with bones in EasyTOK, is possible?


Panno(Posted 2006) [#5]
hi filax

in the demo i see only the mountain texture, the grass texture from the bottom is white is this ok ?

second :how to load the collide sound ?

no example in the sources or iam blind ?

mfg


IPete2(Posted 2006) [#6]
EmerGki,

There is an example in using 3D Studio Max to design the bone structure. by looking at that you could work out how get started, but I do think you'll need to try a variety of settings for hinges etc.

IPete2.


Filax(Posted 2006) [#7]
Panno : It's possible if your graphic card don't support the blend 5

For the sound : Because i have not made :) but it's possible.
look inside the doc please. But the sound with tokamak is not
terrible :/ (cracking) The good method, assign an entity type
and check collisions with blitz.


Angelet(Posted 2006) [#8]
Great news for all EasyTOKers!!!


Damien Sturdy(Posted 2006) [#9]
Neat.


What is Blend mode 5!??? Forgive me, i'm no artist... The blitz manuals say 0-3. so whats 4 and 5? I think 4 was dotmap or somthing?


ZJP(Posted 2006) [#10]
Hi,

Very good job!!!
The "physic terrain" example is incredible !!

JP


Filax(Posted 2006) [#11]
Cygnus : Blend 5 is modulate 2X

ZJP : Cool :)


Avon(Posted 2006) [#12]
Any news on the 1.1 release, filax?


Filax(Posted 2006) [#13]
Yes ! it's ready i think release it monday 23/1/2006 !

I'm a little bit later :) sorry :)

But TerraED Pro take all my time :) (fuc... bugs ...)


Filax(Posted 2006) [#14]
Check your mail box latest release 1.1 was send :)


Murphy(Posted 2006) [#15]
TerraED Pro?
will it be a free update? ;)
wanna have some news on that!!!


Dock(Posted 2006) [#16]
If I were to deform the terrain, would it still collide correctly work?


Filax(Posted 2006) [#17]
Murphy : No TerraEd is a completly new version :) more
user friendly, better editing tool etc ... Many many
features. Due to hard work to make it, the older terraed
customer's, can buy this version with very low price.

Dock : Not in real time.


Filax(Posted 2006) [#18]
Hi dear users :)

What do you want for the next version ?


Alienforce(Posted 2006) [#19]
Filax: Off topic. Did you get my last mail ??


Filax(Posted 2006) [#20]
? sorry ?


ghost(Posted 2006) [#21]
Hi filax,
sorry if it has already been asked but do we need to have 3dsmax in order to use your library ?
What if my main modeler is AC3D ?


Filax(Posted 2006) [#22]
Of course not ! but it's more simple because demo .MAX scene can be openend only with max but the mothod with other's
softwares.


Mr. Bean(Posted 2006) [#23]
Where can I purchase EasyTOK??????????????????


Filax(Posted 2006) [#24]
Hi :)

Here :)

http://www.blitzbasic.com/toolbox/toolbox.php?tool=143


Boiled Sweets(Posted 2006) [#25]
Filax,

please could I have a look at the EasyTok documentation prior to purchase and some example code


Filax(Posted 2006) [#26]
Sended to info@...


Boiled Sweets(Posted 2006) [#27]
filaxOutlook blocked the chm - please could you zip it and try again - sorry for the hassle.

I really apprecaite.


Filax(Posted 2006) [#28]
I hate your mail box :)


Boiled Sweets(Posted 2006) [#29]
Hehe - secure, perhaps a bit too secure.

Anyway - got it, many thanks!

I have a many questions re EasyTok, want me to post them here?


Filax(Posted 2006) [#30]
If you want ;) i have no secret about my products :)


CodeGit(Posted 2006) [#31]
I use EasyTok and it's great. You will also find that the support that Filax offers is first class.


Boiled Sweets(Posted 2006) [#32]
I have been using Filax's BCF for years now (quite literally) and know he is a top coder and all round good guy...

What I want to understand is what EasyTok does for me? Why not just use the TokaMak wrapper? Looking through the EasyTok docs it doesn't seem to cover all the TokaMak functions so I'll have to go to TokaMak for the 'missing' stuff so why not use TokaMak without EasyTok?

I am seriously NOT trying to put down EasyTok I just want to be convinced that EasyTok is a really needed to develop an app with TokaMak...

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?

One of the problems appears to be the lack of tutorials for the beginner for EasyTok.

(Filax could you please email the bb for that demo with the balls rolling down the chutes please) - erm best to zip it.


Filax(Posted 2006) [#33]
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...








Boiled Sweets(Posted 2006) [#34]
So I have to create my scene in Max?

I don't have it.

Can I not just create cubes and scale them and use those as the platforms?

Sorry these questions are so stupid...


Filax(Posted 2006) [#35]
Yes of course :) But you can use lightwave or other modelers if you want :)


Boiled Sweets(Posted 2006) [#36]
Sod it.

Let's do it!

Done!

Now I'm really gonna start bugging you!


Filax(Posted 2006) [#37]
You say : "OK you win :-)"

Lol :) Like alway :)

But please let me juste some time to finish terraed :)


Boiled Sweets(Posted 2006) [#38]
Filax,

no worries - I am head down in qoob at the moment and have tons to do so I won't be bothering you for at least 2 weeks. I'll have a play with the basics and if I really get stuck I'll post here and hopefully someone will help me out (maybe even you).

I've taken a brief look at EasyTok.bb and can see that this lib has saved me a LOT of grief already!


Boiled Sweets(Posted 2006) [#39]
Can I load in a 3ds model and get EasyTok to make it a Animated Body?


Filax(Posted 2006) [#40]
yes read the doc about 3D integration.


Boiled Sweets(Posted 2006) [#41]
1. BUT do I have to create an entire scene?

2. What if I want to just load a single object? What I want to do for example is load a mesh of a tennis racket for example and use that as an animated bofy. Can this be done?

3. also how do I change a balls bounciness?

4. The EasyTOk doc don't seem to include all the functions in the library.

5. And will EasyTok be expanded to include all the TokaMak functions?

6. The sound attached to a sphere seems to play eratically.


Beaker(Posted 2006) [#42]
Can you preview the physics in 3dsMax in anyway? The same as you can using b3dpipeline? If not, it is a shame we don't have the b3dpipeline preview source code to adapt to this purpose.


Boiled Sweets(Posted 2006) [#43]
*BUMP* Filax? COuld you please answer my 6 questions...


Filax(Posted 2006) [#44]
1. BUT do I have to create an entire scene?

Yes, specified in the doc ....


2. What if I want to just load a single object? What I want to do for example is load a mesh of a tennis racket for example and use that as an animated bofy. Can this be done?

Yes, look the function :
TOK_CreateABCube(Name$,Px#=0,Py#=0,Pz#=0,Pitch#=0,Yaw#=0,Roll#=0,Width#=1,Height#=1,Depth#=1,Sound$="",Red=255,Green=255,Blue=255,View%=1)

You can make a copy of this function to use a mesh instead
the createCube !!


3. also how do I change a balls bounciness?

Yes, specified in the doc ....


"4. The EasyTOk doc don't seem to include all the functions in the library."

No it's true but i have try to include the most used functions.


"5. And will EasyTok be expanded to include all the TokaMak functions?"

Of course :) But warning you can use only the functions permit by tokamak wrapper !!


6. The sound attached to a sphere seems to play eratically.

No the sound is correctly played, it's the Tokamak collision
detection the problem, to solve it use standard blitz
entitytype setting (better result)


You must consider EasyTok like a Base to be extended for
your hown using !


Boiled Sweets(Posted 2006) [#45]
You must consider EasyTok like a Base to be extended for your hown using !


AHA! Well I won't be amending the library cos you'll be bringing out an update soon :-)

I'm just trying to get my head round EasyTok / Tokamak wrapper is implemented in terms of what access I have to various things from Blitz.

Regards using my own mesh - doesn't TokaMak only recognise cylinders, cubes and sphere?


Filax(Posted 2006) [#46]
Yes physic with polygon don't work :) only bounding form.


Boiled Sweets(Posted 2006) [#47]
Hi Filax,

if you have a spare moment could you please knock up a tiny bit of code that shows how to make a springboard (like a diving board). So a solid cube attached to a hinged cube that will be affected by a ball dropping on it for example.

Many thanks


Filax(Posted 2006) [#48]
You have it ! :) look the example :

Beginning - From 3D scene 02.bb

Or

Beginning - From 3D scene 01.bb

you must see that :



Look around the large hole you can see a diving board.


Boiled Sweets(Posted 2006) [#49]
But thats from a scene - I cannot create scenes. Can it be easily be done in code?


Filax(Posted 2006) [#50]
Of course ! But you have all necessary files do you look all
examples ?

Look

Beginning - Chain Joint 03.bb

You can see how attach Joint+RigidBody


Boiled Sweets(Posted 2006) [#51]
I'll take a look - sorry for all the stupid basic questions...

I have modified the TOK_CreateABCube function so it takes a mesh. Are you interested in any new functions / modifications for inclusion in later releases?

One last stupid question.

So does a RB always have to repsond to gravity unlike a AB?


Filax(Posted 2006) [#52]
So does a RB always have to repsond to gravity unlike a AB?

Euh ?? sorry i don't understand can you clarify ? for
information Animated body (see doc) are static entity
(yes i know it's really strange) Only Rigib body can be
translated by gravity.


Damien Sturdy(Posted 2006) [#53]
Indeed, That sounds backwards :)


Boiled Sweets(Posted 2006) [#54]
Let me try and explain and you correct me...

I want to have a hinged platform like a spring board (diving board).

My understanding is I need.

1. An AB that is the unmovable / fixed end
2. A RB that is the actual diving board that moves when other RBs land on it
3. A hinged joint between the 2 object above.

Is that correct?


Filax(Posted 2006) [#55]
Yes its correct ! You must understand one thing :

The joints can be attached to nothing ! correction ...
The joints can be attached to only one entity like Rigid body or animated body OR together (Rigib b+Animated b)
etc

Look the example :

Confirmed - Ragdoll 03.bb

You can see that the joint is attached only to one rigid body

Don't panic :) EasyTOK is not difficult, when you understand
the object name system and the joint limit you can make
all that you want :) Start with little examples.


Boiled Sweets(Posted 2006) [#56]
I think there is a problem - this is from the EasyTok docs...

TOK_CreateABCube("Toto1",Rnd(-10,10),40,Rnd(-10,10),0,0,0,2,2,2,"",255,255,1,1) 

TOK_CreateMaterial("MyMaterialICE",5.3,8) 

TOK_ApplyMaterial("Toto1",TOK_TypeAnimBody%,"MyMaterialICE") 


If fails, please try it


Filax(Posted 2006) [#57]
Opps a little bug :)

Goto line number : 1663 and change :

TOKGEOM_SetMaterialIndex R\Geom,TOK_GetMaterialIndex(Material$)

with

TOKGEOM_SetMaterialIndex A\Geom,TOK_GetMaterialIndex(Material$)


Boiled Sweets(Posted 2006) [#58]
Hehe - found one :-)

Changing an objects mass seems to make no difference.

Setting materials as 0,0 and things still bounce...


Filax(Posted 2006) [#59]
:) It's cool :) I am never upset when the users find bugs in my products:)

Error is human :)


Boiled Sweets(Posted 2006) [#60]
Changing an objects mass seems to make no difference.

Setting materials as 0,0 and things still bounce...


Filax(Posted 2006) [#61]
You must modify the linear damping to see mass effect try this :

Because mass define only the object mass value ! but the
visual effect is a mix between : Worl gravity / Damping / RB Material / Mass

And of course ! the floor material is important too !

There is not magic value ! you must make test.




Boiled Sweets(Posted 2006) [#62]
Interesting but I wish all this was explained somewhere. I must say the TokaMaks doc are a little bare...


Filax(Posted 2006) [#63]
Sure ! i have many difficulty to understand this :/


Boiled Sweets(Posted 2006) [#64]
Weird! Where are the textures actually created?


Filax(Posted 2006) [#65]
Please ... Find CreateTexture function under EasyTOK.bb

Function TOK_CreateCheckerTexture()

Line 1900

I'm working on the TerraEd doc i'm busy for the rest of this
day :)


Boiled Sweets(Posted 2006) [#66]
I have found another problem...


cube = CreateCube()

TOK_CreateRBCube("Bar01",cube,Px#,Py#,Pz#-3,0,0,0,10,1,1,Mass,"",255,255,255,1,0)
TOK_CreateJoint("Axis01",1,"Bar01","Bar01",Px#,Py#,Pz#,0,90,0,1,JointType1,100,0,0)


All I'm doing is creating a cube mesh and passing that into the function. Now the problem is RB spheres now pass into the Bar01...

Why?


Boiled Sweets(Posted 2006) [#67]
Filax, pls see the above too...

Can I use the ball / chain models please?


Beaker(Posted 2006) [#68]
Can you preview the physics in 3dsMax in anyway? The same as you can using b3dpipeline?


Filax(Posted 2006) [#69]
Beaker : No !


Boiled Sweets : Clarify with usable code please ! For the chain model yes keep it if you want :)


Boiled Sweets(Posted 2006) [#70]
Filax,

pls try this

http://www.boiledsweets.com/tmp/mesh-err.zip


Filax(Posted 2006) [#71]
In the EasyTOK.bb line number : 618

Replace
ScaleEntity

With

ScaleMesh





Boiled Sweets(Posted 2006) [#72]
Thanks Filax,

I'll keep looking for bugs - you keep fixing em ;-)

So is there going to be a new version of EasyTok with those 2 bugs fixed? And possibly more TokaMak functions exposed? :-)


Filax(Posted 2006) [#73]
Yes i have updated via mail box :)
Three little bug removed

For other's functions wait a little time :)


Boiled Sweets(Posted 2006) [#74]
Thanks.

My first app is very nearly finished. It's shows off EasyTok/TokaMak to great effect I think...


Boiled Sweets(Posted 2006) [#75]
Filax,

sorry no mail from you yet...


Happy Sammy(Posted 2006) [#76]
Hi filax,

Does EasyTok 1.1 support Convex hull?

Thanks in advance.
Sammy
:)


Filax(Posted 2006) [#77]
Not in this version


Gnu(Posted 2006) [#78]
Filax
I just wanted to say your incredibly patient and helpful. keep up the great work

Regards
Gnu


Boiled Sweets(Posted 2006) [#79]
Gnu,

I second that! Filax sorry but I still haven't received the corrected EasyTok...


Panno(Posted 2006) [#80]
no updatemail from you filax


Filax(Posted 2006) [#81]
send me an email i'll replay the lib for you.


Filax(Posted 2006) [#82]
This week i will work on bones+EasyTok to see if it's
possible to control objects bones with anim+physic

Say me : Good luck :)


Boiled Sweets(Posted 2006) [#83]
GOOD LUCK!

And please examples without having to use 3d max...


Filax(Posted 2006) [#84]
I'm sorry but i have not other 3D modeler :/ But i will
try to make a step by step tutorial under doc for bones.


Boiled Sweets(Posted 2006) [#85]
Filax,

you rock! Keep up the good work.


Boiled Sweets(Posted 2006) [#86]
Filax,

bad news, that new 1.2 version has broken your "Beginning -Chain Mesh 01.bb" example.

Please try it - the chain links are no longer visible!


Filax(Posted 2006) [#87]
It's just a scale value problem :

In the example line : 238

Replace the line by this one :
MyCube=TOK_CreateRBCube(Name$+I,Tmp_Chain,Px#,Py#-SizeHeight#,Pz#,0,Yaw#,0,0.97,0.97,0.97,Mass#,"",255,255,255,1,0)


Boiled Sweets(Posted 2006) [#88]
Filax,

more problems I'm afriad, just try hitting the left mouse button. RB Spheres still pass thru the AB cubes

;=======================================================================================
; 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,0
SetBuffer BackBuffer ()

; ----------------------
; Change font text
; ----------------------
AppFont=LoadFont("Arial",15,1,0,0) 
SetFont AppFont

; -------------------------------------
; Setup camera and Easytok
; -------------------------------------
Global Cam=CreateCamera()
PositionEntity Cam,0,25,-40

Proc_CreateVisor()

TOK_InitWorld(0,-40,0,1000,100)
TOK_CreateGround("Floor",150,255,150,10)

; -----------------------------
; Creating demo world
; -----------------------------
Global Light1=CreateLight(2)
PositionEntity Light1,-50,50,-50
LightColor Light1,250,150,50
LightRange Light1,100

Global Light2=CreateLight(2)
PositionEntity Light2,50,50,50
LightColor Light2,50,150,250
LightRange Light2,100

AmbientLight 80,90,100

; -----------------------------
; Create the plateform
; -----------------------------
Global MyCube03=TOK_CreateABCube("Toto0",0,21,0,0,0,0,15,0.25,15,"",255,55,55,1)
TOK_EntityColor("Toto0",110,150,0)

Global Angle#

; -------------
; Main loop
; -------------
FramePeriod = 1000 / AppFPS
FrameTime = MilliSecs () - FramePeriod
MoveMouse GraphicsWidth()/2, GraphicsHeight()/2

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 objects>"
	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)

	; -----------------------------------------
	; Launch a cube and a sphere
	; -----------------------------------------
	If MouseHit(1) Then
;		TOK_CreateRBCube("Toto1",False,Rnd(-10,10),40,Rnd(-10,10),0,0,0,2,2,2,6,"",255,255,1,1,20)
		TOK_CreateRBSphere("Toto2",False,10,40,Rnd(-10,10),0,0,0,2,10,"",255,255,255,1,20)
	EndIf
	
	Angle#=Angle#+2
	TOK_RotateABEntity("Toto0",0,0,Angle)

	; ------------------------------------------
	; Apply impulse to ALL objects
	; ------------------------------------------
	If MouseHit(2) Then
		TOK_ApplyImpulse("",Rnd(-5,5),Rnd(55,65),Rnd(-5,5))
	EndIf
	
	TOK_RefreshPhysic(1.7/AppFPS,10)
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



Boiled Sweets(Posted 2006) [#89]
*bump*


Filax(Posted 2006) [#90]
This problem is 'normal' with tokamak, when you made
too slim objects, the collisions become crazy.

But there is some solutions :

Diminish world gravity : TOK_InitWorld(0,-30,0,1000,100)

Increase box height : TOK_CreateABCube("Toto0",0,21,0,0,0,0,15,1,15,"",255,55,55,1)

Increase physic precision : TOK_RefreshPhysic(1.7/AppFPS,50)


Mike0101(Posted 2006) [#91]
Good luck Filax:)
I can't waiting the animation + physic


Filax(Posted 2006) [#92]
My first tests of bones + RB make me desapointed :/


Happy Sammy(Posted 2006) [#93]
Hi filax,

Rigid body is related to box modelling.
Could EasyTok work with box modelling?

Thanks in advance.
Sammy
:)


Boiled Sweets(Posted 2006) [#94]
Why doesn't this detect a collisiion...

TOK_EntityType("Floor",1)
TOK_EntityType("Toto2",2)
Collisions 1,2,2,3
count = CountCollisions (TOK_GetRBMesh ("Toto2"))

count is 0.


Filax(Posted 2006) [#95]
Please send me exploitable example :)


Boiled Sweets(Posted 2006) [#96]
;=======================================================================================
; 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 800,600,32,0
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

Proc_CreateVisor()

TOK_InitWorld(0,-40,0,1000,100)
TOK_CreateGround("Floor",150,255,150,10)
	TOK_ApplyMaterial("Floor",TOK_TypeAnimBody%,"Plastic")

; -----------------------------
; Creating demo world
; -----------------------------
Global Light1=CreateLight(2)
PositionEntity Light1,-50,50,-50
LightColor Light1,250,150,50
LightRange Light1,100

Global Light2=CreateLight(2)
PositionEntity Light2,50,50,50
LightColor Light2,50,150,250
LightRange Light2,100

AmbientLight 80,90,100

Global Angle#

		TOK_CreateRBSphere("Toto2",False,10,40,Rnd(-10,10),0,0,0,2,10,"",255,255,255,1,20)


TOK_EntityType("Floor",1)
TOK_EntityType("Toto2",2)
Collisions 1,2,2,3

; -------------
; Main loop
; -------------
FramePeriod = 1000 / AppFPS
FrameTime = MilliSecs () - FramePeriod
MoveMouse GraphicsWidth()/2, GraphicsHeight()/2

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 objects>"
	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)

	; -----------------------------------------
	; Launch a cube and a sphere
	; -----------------------------------------
;	If MouseHit(1) Then
;		TOK_CreateRBCube("Toto1",False,Rnd(-10,10),40,Rnd(-10,10),0,0,0,2,2,2,6,"",255,255,1,1,20)
;	EndIf
	

	; ------------------------------------------
	; Apply impulse to ALL objects
	; ------------------------------------------
	If MouseHit(2) Then
		TOK_ApplyImpulse("",Rnd(-5,5),Rnd(55,65),Rnd(-5,5))
	EndIf


		;If MouseDown(1) Then
		Proc_CameraPick(Cam)
	;EndIf

	count = CountCollisions (TOK_GetABMesh ("Floor"))
	DebugLog mesh + " " + count

	
	TOK_RefreshPhysic(1.7/AppFPS,10)
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

Function Proc_CameraPick(Camera)
	Local PEntity = 0 : CameraPick(Camera,GraphicsWidth()/2,GraphicsHeight()/2)
	PickedEntityID = PickedEntity()
	
	If PickedEntityID<>0

	DebugLog "pickeed"
		If TOK_IsRigidBody(PickedEntityID)=True Then
			Tmp_Name$=TOK_GetRBName$(PickedEntityID)
			
			TOK_EntityAlpha(Tmp_Name$,0.5)
			TOK_ApplyImpulse(Tmp_Name$,0,PickedNY#()*30,0)
			TOK_ApplyTwist(Tmp_Name$,0,60,0)
		EndIf 
	EndIf
End Function



Filax(Posted 2006) [#97]
Look the example :

Beginning - Push Object 01.bb

You can see CountCollision process


Boiled Sweets(Posted 2006) [#98]
But Filax,

thats doing a Blitz entity to EasyTok collision. Mine are both EasyTok. Please try my example. It doesn't work. I think there is a problem with EasyTok.


Filax(Posted 2006) [#99]
Boiled :) It's a little bit normal that your example
don't work :/ you have forget to define entityradius for the
sphere .... And your collision order is bad ! You say :

Collisions 1,2,2,3

The solution is :

TOK_EntityType("Floor",1)
TOK_EntityType("Toto2",2)
EntityRadius TOK_GetRBMesh ("Toto2"),5
Collisions 2,1,2,3

When i say, look the example it's to understand this, i have
some reasons :)

The problem is not EasyTok for this time.

Cheers


Boiled Sweets(Posted 2006) [#100]
Filax,

ta. What I really want to be able to do is work out what ab a rb has collided with. If I use the Blitz collisions and the object jumps eratically all over the place.

Basically I have a left and right ab walls and a ab floor. I have a rb sphere and want to know when the sphere has hit the ground. I have tried the TOKSIM_GetCollisionCount() but it returns greater than 0 if ANY collision occurs, i.e. sphere ahs hit a wall. I just want to knwo when the ball has hit the floor.

Is there a way to do this?


Filax(Posted 2006) [#101]
Maybe using a switch value ?

If collision XXX And MySwitch=0
Switch=1
endif

etc like that you can test only one time if the wall is
collided.


Boiled Sweets(Posted 2006) [#102]
Eh?

I don't understand. If I use the Blitz collisions are you described the ball jumps eratically.

I don't understand your suggestion. Is there a way to use...


TOKRB_GetCollisionID?????


Filax(Posted 2006) [#103]
I'm sorry but what exactly your problem ????

I have post the method to know if your RBODY Collide with
ABODY ! What do you want more ?

In you previous example put :

TOK_EntityType("Floor",1)
TOK_EntityType("Toto2",2)
EntityRadius TOK_GetRBMesh ("Toto2"),5
Collisions 2,1,2,3

Instead :

TOK_EntityType("Floor",1)
TOK_EntityType("Toto2",2)
Collisions 1,2,2,3

And in debug mode you will know when Ball hit floor !




Boiled Sweets(Posted 2006) [#104]
Filax,

there IS a problem, use your example but comment out this

	If count>0 Then
		TOK_ApplyImpulse("",Rnd(-5,5),Rnd(55,65),Rnd(-5,5))
	EndIf 


Watch the ball!!!1


Blitzplotter(Posted 2006) [#105]
Filax, I am impressed with the level of support you are giving your product within this forum. It looks like a well structured app, keep up the good work.....


Boiled Sweets(Posted 2006) [#106]
Filax is the best!


Filax(Posted 2006) [#107]
Blitzplotter : Thanks :) Make my possible :)

Boiled Sweets : I have commment this line but ?? what can i see ?

The ball touch the floor,bounce a little bit and ? nothing ?

What is the problem ?


Boiled Sweets(Posted 2006) [#108]
The ball lands as expected then you can see it jumps between the ground and about 1 unit about the ground in a horrible type flicker.


Boiled Sweets(Posted 2006) [#109]
ok so its not the code as it doesn't happen to you so it must something else.

my tokamakwrapper.dll is dated 6/10/2005
and tokamak.dll is 01/08/2005

I wonder why this is happending?


Filax(Posted 2006) [#110]
You think that my wrapper + dll version is bad ?


Boiled Sweets(Posted 2006) [#111]
Well no - yours works it would appear. What dates are yours?

Don't you think it odd that the same code works on your pc but doesn't on mine?

Its a worry as its holding up my development...


Filax(Posted 2006) [#112]
When i do PROPERTIES on the two DLL i can see DLL version :

I can only give you size :

296 KB (303 104 bytes) Tokamakdll.dll
88,0 KB (90 112 bytes) Tokamakwrapper.dll

From the first release of EasyTOK, i have not updated
tokamak dll or wrapper. Your ball bounce problem is
really strange because i don't see it ??


Boiled Sweets(Posted 2006) [#113]
Any other ideas? Im runing Blitz 1.96


Filax(Posted 2006) [#114]
Absolutly not ??? I will try on other computers.


Boiled Sweets(Posted 2006) [#115]
Will there be an easytok for BlitzMax.


Filax(Posted 2006) [#116]
Of course ! :)

EasyTOK updated :)

I have made a new example :) with bombs :) it's funny
try it :)

PS : Some user's email adress have changed !

http://www.blitz3dfr.com/phpfrench/request.php?31

Beginning - Explode 01.exe




sini(Posted 2006) [#117]
Hi Filax,

I have the same problem since 7 months and that continue with the last update (1.3)... I have send you a mail for that in january.

thx


IPete2(Posted 2006) [#118]
Just incase people are wondering...

I have just installed the latest versions of this and it works fantabulously well!

IPete2.


Filax(Posted 2006) [#119]
Many any user's change their email without say me !

Sini : send me an email with your full name , i'll send to you.

IPete2 : The next upgrade will have grenade ;)

The bomb will be integrated directly under TerraEd with some
new stuff like your hown mesh etc ...

If i have the time (Filax need holidays...) i'll try to make
a little level with physic objects + grenade and bomb :)