View Full Version : Xpresso collide and remember
jonahtobias 08-13-2009, 08:14 PM I am stuck on something that is probably simple to solve but has me stumped.
I have 2 objects and an xpresso setup that detects a collision. When they collide one object starts to rise.
My problem is, once the collision condition is no longer true, the object stops rising. i want it to continue rising forever, even if no longer collided. How do I get it to flip to true and then stay their even after it becomes false again?
Here is my basic setup. I hope somebody can help.
c4d project file (http://1q.com/images/uploads/xpresso_collide_and_remember.c4d.zip)
--SOLVED--
Ah, I figured it out. A flipflop node does what i want. Can't say i understand the logic of it, but it keeps the collision set to true, which is what i wanted.
|
|
Rantin Al
08-13-2009, 09:35 PM
See if this (http://www.c4dcafe.com/ipb/index.php?autocom=downloads&showfile=486) makes it any clearer. :)
There are another 2 follow on tutorials building up from the first.
You will need to register to download but it is free.
Cheers, Alan.
jonahtobias
08-13-2009, 09:50 PM
It works when i access the object directly but not when I use hierarchy to iterate through a group of them. Has anybody succeeded in getting flipflop to work with an iterator or is this an xpresso bug?
Thanks in advance for any help.
An iterator goes through a number of states/objects, a FlipFlop node can only store a single bit of information. How do you expect this to work?
Cheers
Björn
jonahtobias
08-14-2009, 10:26 AM
Hi Srek and Al, thank you for the replies!
Its almost like a Thinking particles problem, but without particles. I have thousands of objects. When they are within a certain trigger event I want to change their state. After the the trigger event is no longer true, I don't want their state to change back. Seems to me like the type of problem xpresso was made for. Everything works as expected with the iterator -- except flipflop.
Al -- I had downloaded that tutorial right before you sent the link. Thanks. I don't know about your other 2 tuts, but it does not seem to address flipflop with an iterarator. It does shed light on how the nodes logic works. Would one of the other tuts help me here?
Can this be done with xpresso? Would it help if I posted a project file?
Rantin Al
08-14-2009, 12:48 PM
"A flipflop node does what i want. Can't say i understand the logic of it"
I read this as not understanding the logic of how the FipFlop works.
The 3 tutorials explain the FlipFlop and MonoFlop parameters and operation. The tutorials show how to control a simple gate as a demonstration of using the nodes.
Using the Iteration nodes is not covered. Iterators and other nodes will be covered in the future by individual explanatory tutorials.
A basic file of what you actually need would help.
Cheers, Alan.
FlipFLop can only store a single stat, not one state for each iteration.
You will need to create a bool user data and modify this per iterated object.
Cheers
Björn
jonahtobias
08-14-2009, 01:46 PM
I'm trying to develop a little helper that I'll release to the cgtalk community. But the goal of it is to make setup simple for people. If a required step is manually adding a userdata boolean field to each of potentially thousands of objects, then it's not worth using xpresso for this task. :sad:
If I understand it correctly -- and i probably don't -- as the iterator is going through each object it tests a condition, and when true the object moves, when false it stops. FlipFlop sets a bit internally, which is getting wiped out during the next pass of the iterators for/next loop, and thus not behaving as expected.
So -- and I am thinking out loud here -- maybe if I set a memory node to hold as many states as there are objects in my iterator, and I read the previous state just before I called flipflop, that could work as expected? I've never used the memory node before, so I don't know if it can work that way....
Here (http://1q.com/images/uploads/xpresso_collide_and%20remember2.zip) is a my project file.
That won't work for the same reason. The memory node will store more than one value, but only one item per frame. You will realy need the userdata field i pointed out.
Cheers
Björn
Darter
08-14-2009, 05:36 PM
Here's a solution based on putting each object into a layer upon collision. It seems to be working okay.
EDIT: See below for updated file.
Darter
08-14-2009, 06:27 PM
In case anyone may be so-inclined, here's a version which resets the object positions and layers automatically at Frame 1.
Rantin Al
08-14-2009, 06:30 PM
Added an auto reset instead of manual button.
Alan.
Ach! Same method. Removed to avoid confusion. :)
jonahtobias
08-14-2009, 07:28 PM
Yes! Darter, you've done it! :thumbsup:
Basically you are using the layer setting as storage for the collision state. I didn't know that xpresso could change an objects layer, but I see you are using the Link setting for that.
Thanks to all of you, Srek, Al, and Darter for taking some time to solve this problem. I wish xpresso handled iterators better, seems strange that such a basic function is quite so difficult to code.
Darter
08-15-2009, 01:24 AM
Glad to have been able to help.
The most efficient approach for this sort of thing is to store the changed status at a per-object level. Layers offer a convenient way of doing this. A COFFEE node can be used to store values in an object's base container but in this case it isn't necessary.
CGTalk Moderation
08-15-2009, 01:24 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.