Filax, new EasyTok functions for you to include!

Blitz3D Forums/Blitz3D Userlibs/Filax, new EasyTok functions for you to include!

Boiled Sweets(Posted 2006) [#1]
Please add these to the next official release (I'll be posting a few...)

Function TOK_GetRBBody%(Name$)
	For G.TOK_ObjectStruct = Each TOK_ObjectStruct
		If  G\BodyType%=TOK_TypeRigidBody% And Upper$(Name$)=Upper$(G\Name$) Then
			Return G\Body%
		EndIf 
	Next

	Return False
End Function



Gabriel(Posted 2006) [#2]
I don't use EasyTok, never have, but..

Why does the function definition declare a floating point return value and then the return command returns an integer?


Filax(Posted 2006) [#3]
Ok ! No problem ! :)

Gabriel : The % sign return a int not a float !
if you want return a float you must do a #.


Boiled Sweets(Posted 2006) [#4]
Sorry for the confusion - Gabriel was 100% correct. I amended the original post to match what he said.

Filax,

A couple more, please add these to the official lib - many thanks.

; -----------------------------------------
; Apply a velocity to a direction
; -----------------------------------------
Function TOK_ApplyVelocity(Name$,X#,Y#,Z#)
		For G.TOK_ObjectStruct = Each TOK_ObjectStruct
			If G\BodyType%=TOK_TypeRigidBody%
				If Name$="" Then 
					 TOKRB_SetVelocity G\Body,X#,Y#,Z#
				Else
					If Upper$(Name$)=Upper$(G\Name$) Then
						 TOKRB_SetVelocity G\Body,X#,Y#,Z#
					EndIf 
				EndIf 
			EndIf 
		Next
End Function

; -----------------------------------------
; Apply angular momentum to a direction
; -----------------------------------------
Function TOK_ApplyAngularMomentum(Name$,X#,Y#,Z#)
		For G.TOK_ObjectStruct = Each TOK_ObjectStruct
			If G\BodyType%=TOK_TypeRigidBody%
				If Name$="" Then 
					 TOKRB_SetAngularMomentum G\Body,X#,Y#,Z#
				Else
					If Upper$(Name$)=Upper$(G\Name$) Then
						 TOKRB_SetAngularMomentum G\Body,X#,Y#,Z#
					EndIf 
				EndIf 
			EndIf 
		Next
End Function



When is the next release planned by the way?


Filax(Posted 2006) [#5]
Euh boiled :) do you see under EasyTOK include the function :



?? :) For the update do you receive my beta with ragdoll ?
but don't panic the release coming.


Boiled Sweets(Posted 2006) [#6]
Hi Fliax,

no I didn't see that - will use it. Perhaps the name of the function wasn't clear enough ;-)

But I would like these included too (best check they are correct first :-) )

; -----------------------------------------
; Enable/display gravity to a Rigid Body
; -----------------------------------------
Function TOK_ApplyGravity(Name$,Gravity%)
		For G.TOK_ObjectStruct = Each TOK_ObjectStruct
			If G\BodyType%=TOK_TypeRigidBody%
				If Name$="" Then 
					TOKRB_GravityEnable G\Body, Gravity%
				Else
					If Upper$(Name$)=Upper$(G\Name$) Then
						TOKRB_GravityEnable G\Body, Gravity%
					EndIf 
				EndIf 
			EndIf 
		Next
End Function


; -----------------------------------------
; is gravity enabled for this Rigid Body?
; -----------------------------------------
Function TOK_IsGravityEnabled%(Name$)
		For G.TOK_ObjectStruct = Each TOK_ObjectStruct
			If G\BodyType%=TOK_TypeRigidBody%
				If Name$="" Then 
					Return TOKRB_IsGravityEnabled G\Body
				Else
					If Upper$(Name$)=Upper$(G\Name$) Then
						Return TOKRB_IsGravityEnabled G\Body
					EndIf 
				EndIf 
			EndIf 
		Next
End Function


Yes I did get your update. I'm not too interested in ragdoll stuff just yet. Will these 4 functions be included in the next release? Many thanks.

Just found this gravity stuff and will be VERY useful for me.


Filax(Posted 2006) [#7]
It's ok your function are included :) if you have other's
don't hesitate :)


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

a couple of things, another new function ( that is very useful to me) and a small mod that is also very handy.

PLEASE include these updates!

; -----------------------------------------
; Enable/disable active to a Rigid Body
; -----------------------------------------
Function TOK_ApplyActive(Name$,Active%)
		For G.TOK_ObjectStruct = Each TOK_ObjectStruct
			If G\BodyType%=TOK_TypeRigidBody%
				If Name$="" Then 
					TOKRB_Active G\Body, Active%
				Else
					If Upper$(Name$)=Upper$(G\Name$) Then
						TOKRB_Active G\Body, Active%
					EndIf 
				EndIf 
			EndIf 
		Next
End Function


could you please modify the 2 create sphere functions to allow the number of segments to be passed in, i.e.

TOK_CreateRBSphere(Name$,Mesh%=False,Px#=0,Py#=0,Pz#=0,Pitch#=0,Yaw#=0,Roll#=0,Scale#=1,Mass#=1,Sound$="",Red=255,Green=255,Blue=255,View%=1,Life%=15, Segments%=16)


then in that function...

G\Mesh = CreateSphere(Segments)


Many thanks! This would save me having 3 different EasyTok libs!

For that matter please do the cylinder functions too. Oh and any idea when the next version is out?


Filax(Posted 2006) [#9]
No problem :) Fixed for the moment :



For the release just let me 2 days. There is changes at my
job :/


Boiled Sweets(Posted 2006) [#10]
Woah whats that bomb thing?


Filax(Posted 2006) [#11]
Surprise :)


Boiled Sweets(Posted 2006) [#12]
:-) I guess that'll be the 'explode' function. I tried it but didn't work as expected. I trust you will be adding a bomb demo bb to show it in action?

No worries regards a few days for the release. I've made the changes to my EasyTok here so I'm up and running I just wanted an 'official' release for piece of mind.

A question : there seems to be a problem with entities passing through one another. I think this might be down to the fact that Blitz does do dymanic collisions very well. Try the push object 1.bb, if a cube is moving it's possible for the camera to pass straight through it. Is there a cunning way to prevent this?


Filax(Posted 2006) [#13]
No ! because you know the problem with blitz collisions and
animated/moving objects ... :( I'll release EasyTOK this
night.


Boiled Sweets(Posted 2006) [#14]
Then is it possible to get round this by using a Tokamak sphere as the 'player' and Tokamak cubes?

Would that then handle the dymanic collisions?


Filax(Posted 2006) [#15]
maybe ! i have try some test to control a physic
camera (attached RB sphere to camera) and it work !


Boiled Sweets(Posted 2006) [#16]
WOAH! Could you please send me the example?


Filax(Posted 2006) [#17]
Do you look the example : Beginning - Camera Move 01.bb
It's an example with camera moving with physic + collisions :)


Boiled Sweets(Posted 2006) [#18]
I have EasyTok 1.1 - it does not have that example