Incorrect parameter type error with body:getWorldPoints()

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
jkilla1000
Prole
Posts: 3
Joined: Mon Jul 01, 2013 3:40 pm

Incorrect parameter type error with body:getWorldPoints()

Post 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?
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: Incorrect parameter type error with body:getWorldPoints(

Post by adnzzzzZ »

self.body:getWorldPoints not self.body.getWorldPoints.
jkilla1000
Prole
Posts: 3
Joined: Mon Jul 01, 2013 3:40 pm

Re: Incorrect parameter type error with body:getWorldPoints(

Post by jkilla1000 »

adnzzzzZ wrote:self.body:getWorldPoints not self.body.getWorldPoints.
Wow how did i miss that, thanks!
Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot] and 60 guests