Game Development Community

What's the best way to initiate Precipitation from C++ engine?

by Steven Peterson · in Torque Game Engine · 03/07/2006 (9:41 pm) · 3 replies

I know I've been asking alot lately guys - believe it or not I AM making progress and i think i've learned more about programming the last 2 months then the last 4.5 years... so I really appreciate the help!

I'm at the step where I have to initiate weather effects like Precipitation from the engine. I've been going over the docs about interfacing between the script and engine, and datablocks and have learned some stuff.

It is my understanding that:

- percipitation and similar effects are "started" simply by instantiating an instance of the datablock
- this is "usually" done in script
- the engine(C++) can't call script functions

However I noticed precipitationData is a SimObject of sorts, so could I just instantiate the precipitaion and precipitationData in C++ similar to how it would be done in script?

Think i'm going to sleep on this one, so if any one can point me in the right direction, you'll save me alot of aggravation in the morning!

Thanks,
RavenSlay3r

#1
03/07/2006 (9:48 pm)
"- the engine(C++) can't call script functions"

Take a look at Con::executef
#2
03/07/2006 (10:38 pm)
As Peter mentions, the engine calls script functions (more accurately, they are script methods--functions imply no namespace) all the time...in fact, it's how callbacks occur (things like onCollision).
#3
03/08/2006 (7:31 am)
*doh* You showed me how to use executef to print to the chat-window, I didn't even realize that what i was actually doing was calling a script function.

Guess i'll have to go back and read-agan to see where I went wrong. And con::executef should get me going nicely.

Thanks! :-)