I’ve wanted to give something back to the community for a while, so I’ve written a little sample of a positionable fan which you can turn on/off and move around.
It is far too messy to submit to the code exchange pages, but I wanted to let people know about it as the core of the math is straightforward and should be easily extractable.
This is cool, Matt! I got it to work once, but then it kept giving me errors as I moved the “fan” around…
table: 0x366b10
Runtime error
… Dev/Corona/Corona Game SampleCode/WindTest/main.lua:75: attempt to call method ‘removeSelf’ (a nil value)
stack traceback:
[C]: in function ‘removeSelf’
… Dev/Corona/Corona Game SampleCode/WindTest/main.lua:75: in function <… dev game samplecode> ?: in function <?:214> [import]uid: 9905 topic_id: 2993 reply_id: 9558[/import] </…>
The error is thrown because, apparently, the table variable ‘hypline’ does not have a ‘removeSelf()’ function, however I don’t understand why as the only construction of the ‘hypline’ variable is performed using the ‘display.newLine()’ function. Unless I’m missing something, at some point the ‘hypline’ variable must be replaced by some other object. As you can see in the code, just before the ‘removeSelf()’ is called the variable is printed, always with a non-nil table reference.
If you discover what is causing it to fail in calling the ‘removeSelf()’ I would be very grateful to know. I’m sure it is something typical I may be taking for granted. [import]uid: 8271 topic_id: 2993 reply_id: 9587[/import]
Just adjust the x and y inputs to the applyForce call. For the y just make it 0 and for the x just check the it has the correct +/-. Maybe add some code to make it +ve if it’s -ve when you want west to east wind. [import]uid: 8271 topic_id: 2993 reply_id: 35424[/import]
I know I am late to the party on this topic, but I could use a small push on this. What am I looking for in this demo? I see the fan strength in the terminal, but don’t see anything moving on the screen. Do I need to add a small object?
Sorry for being obtuse (and late)…
David [import]uid: 71572 topic_id: 2993 reply_id: 48995[/import]
Hey very interesting Matt (And I was calling you Horace!!!). A nice use of forces and physics!! Rest assured I’m scooping up all your examples and filing them away for future use! Keep 'em coming, they’re much appreciated!
fixed the nil issue and tried different applyForce but still doesn’t work. The crate simply falls on the ground and despite moving the fan, nothing happens. Any idea? [import]uid: 12109 topic_id: 2993 reply_id: 89849[/import]