Page 1 of 1

Incorrect parameter type error with body:getWorldPoints()

Posted: Sat Aug 03, 2013 3:56 pm
by jkilla1000
In this project that i'm working on I'm getting an error that looks like this:
https://dl.dropboxusercontent.com/u/62302305/error.png

Here is the code:

Code: Select all



object = {}
object.__index = object

function object.create(x, y, rot, height, width, r, g, b, static, density, sticky)
	local o = {}
	setmetatable(o, object)
	o.color = {}
	o.x = x*scaleX
	o.y = y*scaleY
	o.rot = rot
	o.image = image
	o.height = height*scaleY
	o.width = width*scaleX
	o.sticky = sticky
	o.color.r = r
	o.color.g = g
	o.color.b = b

	
	if static == true then
		o.body = love.physics.newBody(world, o.x, o.y, "static")
	else
		o.body = love.physics.newBody(world, o.x, o.y, "dynamic")
	end
	o.body:setAngle(math.rad(rot))
	o.shape = love.physics.newRectangleShape(0, 0, o.width, o.height, o.body:getAngle())
	o.fixture = love.physics.newFixture(o.body, o.shape, density)
	
	return o
end
	
function object:draw()
	local r,g,b,a = love.graphics.getColor()
	love.graphics.setColor(self.color.r, self.color.g, self.color.b)
	love.graphics.polygon("fill", self.body.getWorldPoints(self.shape:getPoints()))
	
	love.graphics.setColor(r, g, b, a)
end

function object:applyForce(xf, yf)
	self.body:applyForce(xf, yf)
end
I am confused as to why this is occurring, I've looked over the code, and it seems to check out. Can, anyone tell me what i'm doing wrong?

Re: Incorrect parameter type error with body:getWorldPoints(

Posted: Sat Aug 03, 2013 4:36 pm
by adnzzzzZ
self.body:getWorldPoints not self.body.getWorldPoints.

Re: Incorrect parameter type error with body:getWorldPoints(

Posted: Sat Aug 03, 2013 5:00 pm
by jkilla1000
adnzzzzZ wrote:self.body:getWorldPoints not self.body.getWorldPoints.
Wow how did i miss that, thanks!