Object Command+ Type Conversion

Blitz3D Forums/Blitz3D Programming/Object Command+ Type Conversion

BlueWolf(Posted 2004) [#1]
Hi, I am not quite sure if this dosen't belong in the beginners fourm but here it goes:

I am trying to write a verlet intergration library. So far I have only four basic functions: CreateParticle(x,y,z,mass) CreateConstraint(p1,p2,stretch) UpdateConstraints() and UpdateParticles() I am having trouble with the CreateConstraint func.

My code looks like this:
Function CreateConstraint(p1%,p2%,stretch#,length#=3)

	constraint.constraint= New Constraint
	constraint\p1=Object.particle(particle)
	constraint\p2=Object.particle(particle)
	constraint\stretch=stretch
	constraint\length=length
	
End Function
but blitz does not like the bit about

constraint\p1=Object.particle(particle)
constraint\p2=Object.particle(particle)


so basically my question is how can I fix this:-) If there is a way to do it without having to alter my constraint type with a field like

Type Constraint
Field particle.particle
Field otherstuff
End Type


that would be good

Thanks


Jeppe Nielsen(Posted 2004) [#2]
The type difintion should have the p1 and p2 fields for it to work:

Type Constraint
Field p1.particle
Field p2.particle
Field otherstuff
End Type


Also se my reply in the beginners forum.


Bot Builder(Posted 2004) [#3]
just wondering, Have you seen any of the verlet libs already written? I wrote one myself...


BlueWolf(Posted 2004) [#4]
Yeah I saw the other verlet libs but I wanted to do one myself. I really like game physics and wanted to be able to know exactly how they worked in my game. But I did study both yours and the one on blitzcoder called verlet3D before I commensed on my own just to get an understanding on how they work.

Oh and sorry for the double fourm post.


Bot Builder(Posted 2004) [#5]
mine's a bit confusing.... I had a whole bunch of crazy collision stuff as an attempt to get around some of blitz's collision probs and yet keep up speed. I'd say I did a pretty good job. although it is hard to set up :(.