Physics swap _Bug

physics_swap_bug.blend (491 KB)

Hi yall

I was attempting to make this, but it doesnt seem working. Can anyone help me?

Thanks yall

I want to say it only changes the mesh data. it is different from object data. I saw u had convex hull , but it didnt take. I know this way may be an issue if the object is like the main character, with all this code on it. I 'm sure its still doable.

Attachments

physics_swap_bug2.blend (491 KB)

thanks cuervo, but i cannot remove the player on the scene. I am attempting to make a dashing function when the collision cube has to be smaller to fit narrow places

DKiesha = own.scene.addObject(‘duckinKiesha’,own,0)
for property in kiesha:
____DKiesha[property]=kiesha[property]

creating a object, and passing all properties from kiesha into it, and then creating a new kiesha and passing then back is a totally acceptable strategy*

o.o u dont know how many complex things the character already has around her. Pretty much, i will skipp this attempt.

for item in complex thing set target/ set parent : Kiesha

the radius of the mesh doesnt change, how can we solve this?

The to-be-replaced mesh is in a hidden layer, you can adjust the radius of both objects and notice the error

Attachments

physics_swap_2.blend (83 KB)

replace mesh and reinstance physics mesh only work with triangle mesh actors.

another option is to have a lower bound and a upper bound,

the lower bound is dynamic cube marked compound, it is the hitBox

the upper bound is a ghost static cube that parents to the lower cube compound
this makes adds the physics shape of the upper bound to the lower bound.

unparent - move upper bound shape - reparent works quite well.

Documentation.
https://www.blender.org/api/blender_python_api_2_67_release/bge.types.KX_GameObject.html#bge.types.KX_GameObject.reinstancePhysicsMesh

The “replaceMesh” object uses reintancePhysicsMesh internally, that function as you can see has a lot of warnings, one of them: “Only works with triangle mesh types”. If you modify the mesh type of both you meshes in your blend you will se how now it works. That’s probably not enough to solve whatever problem you have, so you probably are stick with one of the following options:

  • Replace the object but keep the behaviors. Unfortunatly this doesn’t work very well with SCA, on BGECore Framework or any other OOP (behavior oriented) paradigm it would be a trivial metter. Still you may have luck mutating the python object but I don’t think it’s gonna work.

  • Make one of the objects invisible and a ghost, then spawn the other (with parent) over it. (Probably the simplest way to do it, not very efficient but still a good option). Or since I think you wanted to replace the physics mesh only, don’t make it invisible, make invisible the mesh you spawn.

So here you have your workarrounds. Still this problem should be considered a bug anyway but don’t expect it to be fixed.

C = duck

W = move forward

I cast a bunch of rays and only stand up if it’s possible
I also push the obstruction up at the contact point

Attachments

BPRSuperDuck.blend (513 KB)

ohhh o.o so extendable collision box?