Hi there everyone, I have a big issue with testing simple collision on corona Physics engine. I used the standard circle body options and set the physics draw to hybrid to see the body.
so heres what ive got.
http://picpaste.com/weirdBody-eXdBx5wL.png
above pic, the collision of the smiley is sort of working, because the outline of the circle is colliding with the outline of the rect, i mean it should work like this yeah ?
so… below is a different story.
http://picpaste.com/weirdBody2-7GjZIcqA.png
this time, if i move the smiley to the Right side of the rect, the collision is not working up until the (xy line or the greenred line, i dont really know what it is) because it seems like it is controlling the collision. Where the middle extends out to the green and red line, the collision is happening. Its like the collision is only at a half-a-semi-circle at the bottom right.
Is this natural for physics engine corona? how to solve this. what i need is a full fledged collision according to the Physics body shape. Not according to the greenred line area. Or how do i go about making this work?
Help been testing for days. My main.lua below
local physics = require "physics" physics.start() physics.setGravity(0,0) local StickLib = require("lib\_analog\_stick") local screenW = display.contentWidth local screenH = display.contentHeight physics.setDrawMode( "hybrid" ) -- SETUP GRAPHICS local heroCircInfo = require("HeroCircle") local heroCircSheet = graphics.newImageSheet("HeroCircle.png", heroCircInfo:getSheet()) local background = display.newImage("background.jpg") background:scale(2,2) background.x = 600 background.y = 400 local happy = display.newImage("happy.png") happy.x = 500 happy.y = 400 happy:scale(2,2) local heroCircInfo = require("HeroCircle") local heroCircSheet = graphics.newImageSheet("HeroCircle.png", heroCircInfo:getSheet()) local angry = display.newImage(heroCircSheet, 1) angry.x = 880 angry.y = 560 angry:scale(2,2) angry = angry local angry2 = display.newImage(heroCircSheet, 1) angry2.x = 600 angry2.y = 520 angry2 = angry2 ----- create the analog joystick MyStick = StickLib.NewStick( { x = screenW\*.1, y = screenH\*.85, thumbSize = 16, borderSize = 32, snapBackSpeed = 0.2, R = 0, G = 255, B = 255 } ) ---------------------- happy.physicsOptions = { density = 1, radius = 50, isSensor = false } angry.physicsOptions = { density = 30, friction = 1 } angry2.physicsOptions = { density = 30, friction = 1 } physics.addBody(happy, "dynamic",happy.physicsOptions) physics.addBody(angry, "static",angry.physicsOptions) physics.addBody(angry2, "static",angry2.physicsOptions) local function main( event ) -- MOVE THE Character (obj,maxSpeed,rotate) MyStick:move(happy, 7.0, false) end Runtime:addEventListener("enterFrame", main) function onCollision(event) print("collide!") end Runtime:addEventListener("collision", onCollision) -------------------------------------------------------------------------------- -- Build Camera -------------------------------------------------------------------------------- --- these below is just a camera follow wont affect physics local require = require local perspective = require("perspective") local camera = perspective.createView() camera:add(happy, 1) camera:add(angry, 2) camera:add(angry2, 2) camera:add(background, 3) MyStick:toFront() camera:setParallax(1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3) camera.damping = 10 -- A bit more fluid tracking camera:setFocus(happy) -- Set the focus to the player camera:track() -- Begin auto-tracking