Home / Topic / Touch Joints (i.e., dragging physical objects)

Touch Joints (i.e., dragging physical objects)

Home Kwiksher Forums Roadmap – Feature Request Kwik Touch Joints (i.e., dragging physical objects)

Viewing 5 posts - 1 through 5 (of 5 total)
  • pjrich
    Participant
    #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
    end
    
    Administrator
    Keymaster
    #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.

    pjrich
    Participant
    #81872

    Alex,
    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).

    Fionnuala
    Participant
    #83971

    Hi

    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 mil

    Yamamoto
    Keymaster
    #83972

    Please check the coronalab’s doc. I will update kwik’s user guide near future
    https://docs.coronalabs.com/guide/physics/physicsJoints/index.html

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Privacy Preference Center

Strictly Necessary

these coolies are for WP-SpamShield, gdpr-wp, woocommerce, paypal

PHPSESSID, SJECT16, JCS_INENREF, JCS_INENTIM, gdpr, woocommerce_cart_hash, woocommerce_items_in_cart, woocommerce_recently_viewed, wordpress_, wordpress_logged_in_, wordpress_sec_, wordpress_test_cookie, wp_woocommerce_session_, AKDC, akavpau_ppsd

Functionality

WordPress cookie created when auto-saving a post in the editor.

wp-saving-post, wp-settings-, wp-settings-time-

Performance

google analytic

__utma,__utmb,__utmc,__utmz,_ga,_gid,_gat

Advertising