are real time constraints possible in the BGE? Or is there any other way to get an object to stick to another object? If so can you please tell me because I am trying to make a crane game where you can pick up stuff. Even magnets will do.
there are rigid body constraints and parenting actuators
parenting is what you need, i think if you have a collision sensor hooked to a parent actuator(and something more complex for the release) you should get a pretty good “crane” effect
could u post a .blend file?
i dont really have time to make one right now, but even if i did it wouldnt show you much except for a logic brick setup, which is something best learned by yourself by experimenting so you really understand it
but just look in the actuators for one called “parent”
I have tried that but I need the object to still be able to collide with walls and stuff
not sure but i think you can make the sensor also disable physics with python somehow
you just have to write a script that disables collision for the object being picked up and hook it up as a controller to the collision sensor
i dont speak python though =/
is there any way to have a wall that consists of small planes that are connected, then if something hits it, it comes apart? like, it unconnects?
yes, but how you set it up depends on what you are doing it for
and you would really have to fake it
you could have all the planes parented to an empty and when the colliding object gets too close, the empty orphanizes all of its kids =] and then hits the wall sending planes everywhere making it look like it broke the wall
You wouldn’t use parenting, because parenting a dynamic object to anything else makes it freak out. What you need to use is PhysicsConstraints. Heres what you do:
On the crane object (the end piece, the object that is supposed to pick your stuff up) add two sensors: a collision sensor, property: “object” and name it “collision”; a keyboard sensor, key: Space key and name it “space”. What this means is that you can pick up objects when the crane is touching it and you press space (obviously you can change it so it goes on a mouse click or whatever you want). Now add two properties to your crane object: a timer property called “cranetime”; and an integer property called “const”. Now connect both of those sensors to a python controller, with python: “constraints”. Now make a python file in the text window (or whatever its called) called “constraints”. Now type this script:
import PhysicsConstraints as pc cont=GameLogic.getCurrentController() own=cont.getOwner() coll=cont.getSensor('collision') space=cont.getSensor('space').isPositive() if coll.isPositive() and space: if own.cranetime > 0.7: if own.const==0: obj=coll.getHitObject() if obj: id=obj.getPhysicsId() if id: own.const=pc.createConstraint(own.getPhysicsId(),id,2,[0,0,0],[0,0,0]) own.cranetime=0 else: pc.removeConstraint(own.const) own.const=0 own.cranetime=0
here you go fully working: http://files.filefront.com/help+ludicrousblend/;11401558;/fileinfo.html
here you can find more info
OMG!!! Thanks guys!