Is there anything in BGE that can attract an object?
digiman
Is there anything in BGE that can attract an object?
digiman
Logic … -> And -> Edit Object “Track to” ?
Gxy.
Details please.
Yea, but you would need to have a logic brick setup with a track-to actuator on every object you wanted to potentially attract.
It’s not a very flexible option.
I would use a script to make the whole operation generic, and independent of any additional bricks on the target object.
If anyone is interested, I made a small demo (attached).
generic_attract.blend (157 KB)
Cool! If you turn up the force a bit, you can make the spheres fly!
What i am trying to do is make my objects be attracted to smaller objects (food) then eat them and of course i will kill the object (food) once eaten, can i do that? Not sure if logic bricks alone will work, Social’s blend might work, not sure though.
Gxy’s suggestion sounds good as well, considering i only want to attract type of object
digiman
You will probably have to use python a bit, to find the closest food and stuff. I don’t have time to prepare you a blend right now, but if some one else does not, I will later.
That would be great Sunjay, it would really help out a lot
digiman
So what you want is, in summery, to make the object find the closest food, then go to it, then eat it?
Edit: Here is a blend of that: MoveToClosestFood.blend (345 KB)
I kind of did it really fast…so I didn’t comment a lot of the code. Instructions are on the top, and the main stuff you should be looking at are in the function called main, near the bottom. Tell me if you want me to comment it.
What i wanted is eating food but does not have to be closest more like a fish eating where he moves around a bit then swallows, i can’t get your blemd working so i can’t comment on it. Yes if you hav ethe time please comment I don’t know python that well
digiman
So what you want is that object eats food with animation ???
Hard to quess what you need, give basic .blend and tell what to do with it.
Gxy.
I just want my objects to go for the food and eat once food is given yes there will be some animation. Don’t have a blend yet that’s what i am working on
digiman
What went wrong in my blend? Did you get any script errors in the black console?
I get syntax error on line 80 it says Snytax error EOL while scanning string literal on the first line
I was thinking how i explained what i wanted and it is a bit confusing I want to add food by pushing a key(easily done) then my objects would detect the food, go for it and eat it but there would be no rush to eat, objects would swallow one then another after a few passes, that kind of thing. I will try to make a quick blend if you can’t understand my explanation but i am pressed for time right now, let me know
By the way i am using 2.49
digiman
If anyone is interested, I made a small demo (attached). Attached Files
generic_attract.blend (156.9 KB, 16 views)
I’m very, very interested. I made it a gravity blend, by replacing the cube with a sphere and an always sensor. Added a cube and named it sphere… now if only the cube would stick to the sphere’s surface while it rotates…
Yeah…mine is in the 2.49 API.
Press back space on line 80.
There is a random ’ mark.