Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by riceje7

So i am trying to port the BlobSallad library into an Impact plugin. I've gotten the structure all changed over into modules and each class is extending ig.Class. However I can't get any blobs to show up in my canvas element. I've neve done any custom drawing to the canvas in impact so i'm unsure if that part is valid or not. Here is the Github for the current progress on the port BlobSalad-Impact. If you all could take a look to see if you see something that i'm not. Thanks a ton!

1 decade ago by lTyl

You don't need to re-write the entire library to be compatible with Impact - it will usually work as-is, you just have to write code that links up the Blob Physics API with the Impact API (Which is what your plugin should do)

Example, in your index.html include the JavaScript API like so:
<script type="text/javascript" src="path/to/file.js"></script> 

Then in your plugin:
.defines(function () {
var Joint = window.Joint;

className = ig.Class.extend({...
// Initialize it like this:
var newJoint = new Joint(params...);

Then you can use:
this.newJoint.scale(this.scaleFactor);

Which will call the scale method in 'Joint' within the BlobPhysics API.

Then for drawing:
                var canvas = ig.$('#canvas');
                var ctx = canvas.getContext('2d');
// Call the draw method, and pass the context as a param

It's a rough and simple example, but I hope I was clear enough to understand. Best of luck in your project.

1 decade ago by riceje7

Thanks, I didn't think of that. But I think I'm picking up what your putting down. I'll hack away at it and if i run into any problems I'll let you know. Thanks again.

1 decade ago by riceje7

awesome!! i got the blobs showing up and moving around the screen now all i need to do is to get it interacting with the impact world (collisions, camera, etc.) thanks again!
Page 1 of 1
« first « previous next › last »