Tokamak Water combined with water ripple

Blitz3D Forums/Blitz3D Programming/Tokamak Water combined with water ripple

Guy Fawkes(Posted 2011) [#1]
Hi all, I'm having a bit of a problem getting this code to work.

What I have done is combined Tokamak Physics code which is a water physics simulation, with a demo that creates ripples when an object "touches" the water.

the tokamak part is fine, but the PROBLEM is these lines:



for some reason, it's saying that the entity "water", doesn't exist. which it CLEARLY does...



If you need me to, I can upload a copy of the DECLS and DLLs for Tokamak.

Thanks everyone for all the help! :)


H&K(Posted 2011) [#2]
You see how there are FOUR lines that referance "Water"?
Well which one is the error on?

Anyway doesnt this need a return type?
Function fxWater_Create( name$="", width=1, depth=1, damp#=0.01, parent=0 )



Guy Fawkes(Posted 2011) [#3]
anything after water= is the problem apparently.


Floyd(Posted 2011) [#4]
I searched this site for fxWater_Create and followed the first link other than this thread.

It contains sample code, including
Global w1 = fxWater_Create( "floor",  DEMO_WATER_WIDTH, DEMO_WATER_DEPTH, 0.025 )
water = fxWater_get_entity( w1 )
PositionEntity water, 0, -10, 0
This is what you have, except for the call to fxWater_get_entity. So fxWater_Create must be returning a more complicated object, part of which is the actual water entity.

Edit: Now that I've actually looked at the code it creates something called an fxWaterWave:
Type fxWaterWave

	Field id
	Field name$
	
	Field active		;if not ripples then fx is not actiave
	
	Field parent		;parent entity (if any)
	Field entity		;water mesh
	Field surface		;water surface

	Field bank1			;pointers to array for mem storage
	Field bank2

	Field width			;width of plane / surface
	Field depth			;depth of plane / surface
	Field dampening#	;water dynamics

End Type


Last edited 2011


H&K(Posted 2011) [#5]
Well reading rez post FXWater_Create has at the end of it
;return mesh handle
	Return Handle(w)
	
End Function
Im not saying you are wrong, as its my opinion that its a return type error as well. But it does look like he has tried to "handle it"
@Rex If the above fix worked, move if to inside the type.

;return mesh handle
	Return fxWater_get_entity(w)
	
End Function



Guy Fawkes(Posted 2011) [#6]
here's what i have in my globals section.

it's not working still.

same error, same line.




Gabriel(Posted 2011) [#7]
same error, same line.

Well unless you've posted the wrong code, you still haven't made the change that Floyd told you to make, so it's hardly surprising that you've still got the same error on the same line. You're still calling two different entity commands and one mesh command on an object which patently isn't an entity or a mesh. Only *then* do you get the entity handle, which you then use incorrectly, as the only function you give it to is the one you *didn't* need the entity for. For that, you needed the water object.

It looks to me as though you're trying to run before you can walk. You're using code (presumably) written by someone else that you don't understand. It isn't going to end well. I know that learning the basics is boring, but it avoids all the frustration you're getting now.

Im not saying you are wrong, as its my opinion that its a return type error as well. But it does look like he has tried to "handle it"

Handl'ing it doesn't make it an entity though. It just switches between object and handle. It's not an entity. The entity is a field within that object. I'm also pretty sure that's not Rez's code.

Last edited 2011


H&K(Posted 2011) [#8]
Handl'ing it doesn't make it an entity though. It just switches between object and handle. It's not an entity. The entity is a field within that object. I'm also pretty sure that's not Rez's code.
I did realise that which is why I also said use fxwater_get_entity. My point was that he at least knew he had to get a handle, which is a step in the right direction.

The thing I dont know, which made me "hedge" my comment was if B3d needed to define a return type or not.

The way I see it, is that even tho I dont know the answer to solve the problem, I could at least point out where the problem was. (I dont have b3d, just the sdk so Im guessing most of the time on syntax). Obviously my comments are only helpful to ppl who have simply overlooked the reason, and not ppl who dont understand the code at all.

I should probably stop replying to REZes posts if this is the case.

Last edited 2011


Guy Fawkes(Posted 2011) [#9]
hey wo wo WOH.

I did TOO post the fix.

Look

Global water

water = fxWater_get_entity( Water1 )


Guy Fawkes(Posted 2011) [#10]
Either way, that's ok mates. I'm switching to Newton Physics, you guys can close this thread! :)

Thanks for the help! :)


Gabriel(Posted 2011) [#11]
I did TOO post the fix.

water = fxWater_get_entity( Water1 )

As I already explained, this is NOT the fix. That line goes after you've already tried to use the object as an entity three times, and it puts the entity in the wrong variable, where you subsequently proceed to use the entity as an object. Instead of fixing things, you've actually broken them even worse.

My point was that he at least knew he had to get a handle, which is a step in the right direction.

He doesn't though. The Handle/Object thing is completely unrelated to entities. If it was an entity, he could use it without handl'ing it.

I should probably stop replying to REZes posts if this is the case.

Well the same could be said for me in that respect. We're both in the same boat in that you don't own B3D and I no longer have it installed, and we're both just trying to help when someone is obviously struggling.

Either way, that's ok mates. I'm switching to Newton Physics

Newton physics will still require you to not mix entities and objects up. It will still require you to learn and practice the basics of programming. All you're going to achieve by switching physics engines is to lose the progress you already made by trying to solve this. You're not far off making this work. It would be a shame to throw it all away.