pjrichParticipantJune 6, 2014 at 2:26 am #81806
I thought from watching the demos that I’d be able to drag physical objects and have them remain dynamic (so that they can still interact with other physical objects). When making a physical object with a dynamic body draggable, it fights against gravity in the physics engine. I noticed from looking at the forums that there was quite a bit of discussion on this last Sept. and Oct. I thought I might be able to resolve it by adding a touch joint in the joint properties but, alas, touch joints seem to be missing from the equation. I noticed that Alex suggested to change the body type to kinematic, which might normally do it (though since kinematic objects won’t interact with static objects, it would make passing through walls possible, which could cause problems).
What is the chance that you might be able to add the ability to create a touch joint? I’m not sure what it would require from the Kwik side of things, but in Corona, here’s the code I use for creating draggable physical objects:
-- basic dragging function local function dragMe(event) local self=event.target if event.phase == "began" then display.getCurrentStage():setFocus(self,event.id) --create a touch joint so that gravity doesn't pull the object down self.tempJoint = physics.newJoint( "touch", self, event.x, event.y ) self.isFocus = true self.isFixedRotation = true --stop the object from rotating while being dragged elseif self.isFocus then if event.phase == "moved" then self.tempJoint:setTarget( event.x, event.y ) elseif event.phase == "ended" or event.phase == "cancelled" then display.getCurrentStage():setFocus(self,nil) self.isFixedRotation = false self.isFocus = false self.tempJoint:removeSelf() end end return true endAdministratorKeymasterJune 6, 2014 at 9:41 am #81812
Not simple as your example in Kwik because it uses a completely different (and much more sophisticated) library to handle all gestures. I added the request into the future feature list.pjrichParticipantJune 9, 2014 at 9:25 am #81872
Great. I’m excited this is in the queue. I thought I might be able to grab the “event” and try using external code to start and stop the touch joint, but as you mention, it’s not that simple (I wasn’t able to grab the event and just got errors).FionnualaParticipantJuly 7, 2015 at 11:47 am #83971
Just wondering if there is any info anywhere on how to use the Optional Parameters on physics joints? There doesn’t seem to be any info in the User Guide on this.
Thanks a milYamamotoKeymasterJuly 7, 2015 at 10:03 pm #83972
Please check the coronalab’s doc. I will update kwik’s user guide near future
You must be logged in to reply to this topic.