Very simple physic wrapper :)

Blitz3D Forums/Blitz3D Userlibs/Very simple physic wrapper :)

Itmbin(Posted 2007) [#1]
It is a first attempt to create physic wrapper with minimum functions :)

To introduce entity to physics use wdDynamic(entity) or wdStatic(entity).

wdSetControl(entity,True) will make entity controllable through standart blitz functions (PositionEntity,RotateEntity,MoveEntity,TurnEntity)

Example:
; Create graphics
Graphics3D 600,600,32,2
cam = CreateCamera()
PositionEntity cam,0,10,-20
light = CreateLight()
SetFont LoadFont("Courier New",20)

; Load mesh
Entity = CreateCube()

; Position and rotate
PositionEntity entity,0,20,0
RotateEntity entity,60,60,60

;====================================
;== (wd) Physicalize this mesh as dynamic entity ==
;====================================
wdDynamic(entity)


; Create plane
plane = CreatePlane()
EntityColor plane,150,170,255
EntityAlpha plane,.8
CreateMirror(plane)

;==================================
;== (wd) Physicalize the plane as static entity ==
;==================================
wdStatic(plane)

; Main loop
While Not(KeyHit(1))


	;== (wd) Update physics by 0.01 seconds ==
	wdUpdatePhysic(0.01)
	
	; Render 
	RenderWorld
	Flip
Wend


dll, decls and 3 samples is here:
http://itmbin.nm.ru/newton/nwmini.zip

Any comments and ideas are welcome :)


Danny(Posted 2007) [#2]
very impressive man, wel done!

It's defenitly very very simple to use. Keep it like that!

Because I think THAT's were it's power lies (from a first impression)! There are several physics engine's out there, so why should we need a new one? Well, one reason could be because ANYONE can use this one in under a minute! No endless complex tweaks on 3 dozen simulator variables or having to store all kinds of handles and what not.
Beware of 'the car freaks' though! I'm sure they'll be knocking on your door soon ;)p

Is this based on an existing engine (newton perhaps) or something you made yourself?

D.


Vorderman(Posted 2007) [#3]
Beware of 'the car freaks'


Yeah, I demand an inbuilt tyre physics and friction model, also a suspension joint and preferably up to the standard of Live For Speed / Gran Turismo etc...

Oh yeah, by tomorrow please.

:)


Ricky Smith(Posted 2007) [#4]
Very nice demos and really nice simple commands. Nice work!
Perhaps you could do easy joint creation using something like:
wdLink(entity1%,entity2%,type)


jfk EO-11110(Posted 2007) [#5]
This really sounds good, looks like you can easily add it to an existing, complex game. Got to see how it interacts with Blitz Collision.

Joints, agreed would be nice.


Wayne(Posted 2007) [#6]
Tried this with win 2000 pro and nothing happens. No physics going on. The larger newton wrapper works fine.

I'll try it on win xp.


ICECAP(Posted 2007) [#7]
Umm, would there be a reason that the physics don't seem to be working at all?
There are no errors, but I seem to have the same problem as Wayne, nothing happens... just sits there as if waiting for something. Possibly the cows? :P


jfk EO-11110(Posted 2007) [#8]
I think the example in this thread is only to show how to set things up.

You may have to add someting that will push the object, or drop it or so.


lo-tekk(Posted 2007) [#9]
Have you got the zip downloaded ? The samples from within the archive will run for a certain amount of cycles and then stop.
Seems the same as with the big newton-wrapper demo.


jfk EO-11110(Posted 2007) [#10]
Seems to be questionable if it's for free or not...


Danny(Posted 2007) [#11]
And it's tough designing games that may only last for 6 seconds! Hmm..


bytecode77(Posted 2007) [#12]
its just a static scene. no movement.


ICECAP(Posted 2007) [#13]
No movement for me either.


ZJP(Posted 2007) [#14]
No movement for me too ?

JP


Itmbin(Posted 2007) [#15]
I'm trying to find this bug. The main trouble is that i can't repeat it on my computer. It works well. I will work on it


jfk EO-11110(Posted 2007) [#16]
Make sure you don't use a float for an entity handle somewhere. This is exactly one of those things that make it work on some machines, and fail on some others.


Chroma(Posted 2007) [#17]
Works fine here...up until the collision turns off after a little few minutes. I do like it though.


t3K|Mac(Posted 2007) [#18]
i defined my own level (200 surfaces, 40000 tris) as wdstatic() - all i get is a MAV. Is there any polylimit? any other limit?
i also did a few tests with flip false - very often your wrapper locks up.

but i like the easy principle of this wrapper. exactly what i'am looking for.


t3K|Mac(Posted 2007) [#19]
any news on this wrapper?


Itmbin(Posted 2007) [#20]
I found that bug. But i don't know how to eliminate it.

As you can see, i determine entity class within wrapper functions and that code didn't work properly on all computers.

Now i'm trying to get entity class within wrapper, but maybe it will be necessary to add class parameter.


Barliesque(Posted 2007) [#21]
@Itmbin:
Are you still developing your Newton wrapper?


Itmbin(Posted 2007) [#22]
@Barliesque, yes.

It seems that bug has been found. The new version should run correctly on all computers ;)

Try it :)
http://itmbin.nm.ru/newton/nwmini.zip


t3K|Mac(Posted 2007) [#23]
yes it works. cool ;) just the testing time is too short.


xmlspy(Posted 2007) [#24]
There's an mav when you free the entities.

After you add 5 or more entities and then free them it will give a MAV.

Const count = 5
Dim cubes(count)
For i = 1 To count
cubes(i) = CreateCube()
wdDynamic cubes(i)
FreeEntity cubes(i)
Next


Barliesque(Posted 2007) [#25]
Wow! This is a brilliantly simple physics library. I love the "Magic Wand" approach of simply turning a regular mesh into an active member of the physics world. Soooo little coding!


t3K|Mac(Posted 2007) [#26]
could you add wdFriction() & wdElastic()? and where can i get this wrapper (fullversion)?


Barliesque(Posted 2007) [#27]
@Itmbin
I was wondering if you're planning on implementing this super simple kind of support into your full Newton library--where you'd be able to instantly turn meshes into physics objects (magic wand style) and then customize whatever settings need to be adjusted with the full library of functions.

[EDIT]
What am I saying?! Your full library is already just about as simple to use as well. Excellent work!


RGR(Posted 2007) [#28]
.

Last edited 2012


RGR(Posted 2007) [#29]
.

Last edited 2012


Vertigo(Posted 2007) [#30]
wdDynamic(entity) gives me a MAV.... :S


Itmbin(Posted 2007) [#31]
Is your version of Blitz 1.98 ?
Can you share or e-mail me the model caused such MAV? Or does it happens with samples?


RGR(Posted 2007) [#32]
Blitz 1.96
And the MAV happens with all of the 3 samples - and only at wdDynamic


ZJP(Posted 2007) [#33]
static. Blitz 1.98, Amd 3400+, Win XP Pro sp2. Radeon 9600pro


t3K|Mac(Posted 2007) [#34]
where can i get this wrapper? is it using the same key as the normal newton wrapper by itmbin? when i purchase the key for the newton wrapper, will it work with this one?


Barliesque(Posted 2007) [#35]
There is no key. It appears to be free ...though it is extremely simple at this point.


t3K|Mac(Posted 2007) [#36]
but why is there timelimit?


t3K|Mac(Posted 2007) [#37]
ah, i redownloaded the file, and the limit seems gone (at least much longer). great!

but i get a MAV on my level again ;(


jfk EO-11110(Posted 2007) [#38]
Do I get this right, this is now a free thing? (free as in free beer) And there's no limitation anymore. What means "at least much longer"?

Do you mean it stops working after a few minutes due to a trial version limitation, or is it just instabile?


t3K|Mac(Posted 2007) [#39]
theres still a limit. the number of UpdatePhysics calls...


Chi3f Stadi(Posted 2007) [#40]
It works for ~5 minutes ... i'm not sure if it depends on the UpdatePhysics call.

I don't think it will be free ... unfortunately


jfk EO-11110(Posted 2007) [#41]
Edit, uh, this was offtopic. so I removed it.


Quantum(Posted 2007) [#42]
On my system the demos run fine... but when I use it in one of my own projects... the object (a cube .b3d object) falls right through the ground plane (a height-mapped terrain)?

But from what I've seen in the demo, this could be just what I've been looking for!