After the “go.set_parent() function collapse objected display unexpected behaviour

After the “go.set_parent(go.get_id(),go.get_id(“baseline”),true)” function collapse objected display faced unexpected behaviour.

  1. object 1 move to another location and it not on the base object

  2. object 2 not collapse with the object1(problem 1 object)

without go.set_parent() function(in block.script file) ,object place as expected and but i cant move object1 and object2 with the base object


i have attached the source with this post and please help me.

Mobile game.zip (294.4 KB)

I haven’t had a chance to take a look at the code yet, but I wonder if it has to do with the objects being dynamic?

Yes for block objects(object1 and object2), I used dynamic type and for the base object, I used kinematic types.

I think this is a bug.before another object(object 3 ) collapse with the base object, it acts as collopsed.

please help me .i am dying hear

Are u trying to get the kinematic object(red I think u mean) to collide with the dynamic object

I think kinematic needs its own script to react to the dynamic object and needs the mask and group to tell it what it reacts to or not, read the collision objects manual and physics manual and learn more

If ur trying to make it so if the red platform falls when the other color platforms hits I think u can do it by using some critical thinking and the walking astronaut tutorial formula script I always use that script to do any movement for some reason

Remember soon u will only use kinematic tons of kinematic I started in jan and I did not expect myself using so much kinematic

OH I GET IT ur trying to make it so when the red object moves with the rest of the objects on it the rest also moves like a tower game

this is what u can do
Remember this isnt real life and this is just a game engine after all so not everything is realistic 1000%

So what u have to do is make the falling objects kinematic

Then use the walking astronauts tutorial movement script and do something like

Follow up message comin up doin it just for u bro

if it is me i would do this btw im a messy coder that types with only two index fingers and a good sense of where buttons are

since it is confirm u cannot manipulate group and mask ob an collision object we will set our own group and mask variables

so first u set the group to blocks and the mask to blocks

then in ur script
something like this in the init function

self.group = falling_objects
self.intact= false --intact to the tower

in the message function be like

if message id ==  hash("intact") then
       self.intact = true
end

then in the input function be like

if action_id == hash("left") then
            if self.intact == true then
                          self.group = baseline
                          --here do the move left command using some critical thinking and astrounaut tutorial script
            end
end

okay

so in another script just for the collision also connected to the game object
THIS IS EXTRACTED FROM THE PHYSICS MANUAL IN THE DEFOLD WEB
function init(self)
– correction vector
self.correction = vmath.vector3()
end

function update(self, dt)
  -- reset correction
  self.correction = vmath.vector3()
end

function on_message(self, message_id, message, sender)
  -- Handle collision
  if message_id == hash("contact_point_response") then
     msg.post("scipt that is up there just now","intact")
    -- Get the info needed to move out of collision. We might
    -- get several contact points back and have to calculate
    -- how to move out of all of them by accumulating a
    -- correction vector for this frame:
    if message.distance > 0 then
      -- First, project the accumulated correction onto
      -- the penetration vector
      local proj = vmath.project(self.correction, message.normal * message.distance)
      if proj < 1 then
        -- Only care for projections that does not overshoot.
        local comp = (message.distance - message.distance * proj) * message.normal
        -- Apply compensation
        go.set_position(go.get_position() + comp)
        -- Accumulate correction done
        self.correction = self.correction + comp
      end
    end
  end
end

so this will send a message to the main script telling it to be intact with the main body to react to the left and right keyboard input, since the falling objects is one by one, they will not colide mid air while falling, if u are going to have different falling platforms(eg speedy ones, slow ones) you can just use stuff like

if self.group == baseline then -- this is a self made up variable in script not the real mask and group
           react to this crap

so they dont react to each other nor.

useful information
there is a random number generator on assets portal really useful
groupt and mask is just a built in if group == a then react u can make ur own