Search found 72 matches

by unixfreak
Sat Apr 22, 2017 9:22 pm
Forum: Support and Development
Topic: [SOLVED] Bezier Curves, how to trace a line?
Replies: 21
Views: 5048

Re: Bezier Curves, how to trace a line?

Yes, you should just feed it derivative coordinates. I had to offset resulting angle because your sprite is rotated. I had a feeling i was plotting the derivative wrongly, but seems that was not the case. :awesome: Many thanks! That works perfectly. Thank you everyone for the suggestions / examples...
by unixfreak
Sat Apr 22, 2017 8:21 pm
Forum: Support and Development
Topic: [SOLVED] Bezier Curves, how to trace a line?
Replies: 21
Views: 5048

Re: Bezier Curves, how to trace a line?

My maths knowledge isn't too great, but that makes things more understandable. I have just been fiddling around with math.atan2 in an attempt to rotate a sprite along the derivative curve, but can't seem to get it to work right. I put together a small love file with relevant code of what i am trying...
by unixfreak
Sat Apr 22, 2017 7:33 pm
Forum: Support and Development
Topic: [SOLVED] Bezier Curves, how to trace a line?
Replies: 21
Views: 5048

Re: Bezier Curves, how to trace a line?

On the topix of bezier curves, I tried to look through Ref's example, where the car moves around the track, although i can't work out what is actually going on in the code to rotate the sprite in the correct direction of movement. I do see this on the wiki: https://love2d.org/wiki/BezierCurve:getDer...
by unixfreak
Sat Apr 22, 2017 5:09 am
Forum: Support and Development
Topic: [SOLVED] Bezier Curves, how to trace a line?
Replies: 21
Views: 5048

Re: Bezier Curves, how to trace a line?

But it is referenced, by the ipairs iterator. You are basically pulling elements out under the iterator, which also moves all indices back by one, making it skip entries. Then i suppose it must be good practice to iterate over all tables backwards where items are added/removed in a loop every time?...
by unixfreak
Fri Apr 21, 2017 6:48 am
Forum: Support and Development
Topic: [SOLVED] Bezier Curves, how to trace a line?
Replies: 21
Views: 5048

Re: Bezier Curves, how to trace a line?

Read the following post it covers the problem https://love2d.org/forums/viewtopic.php?f=4&t=83667&p=210479&hilit=ipairs+game#p210511 I'm fully aware of how that can cause problems in some use cases, but it isn't important here. The i value is only being used to remove that index from the list, it's...
by unixfreak
Fri Apr 21, 2017 2:13 am
Forum: Support and Development
Topic: [SOLVED] Bezier Curves, how to trace a line?
Replies: 21
Views: 5048

Re: Bezier Curves, how to trace a line?

Thanks that makes sense now, i changed it a little so that the target is always added at the exact end of the bezier curve. Many thanks. I understand the ipairs function, i don't see what you mean there though. But this is working great nicely now. :awesome: function missiles.update(dt) for i, missi...
by unixfreak
Thu Apr 20, 2017 12:35 am
Forum: Support and Development
Topic: [SOLVED] Bezier Curves, how to trace a line?
Replies: 21
Views: 5048

Re: Bezier Curves, how to trace a line?

Thank you both, very much this has helped alot. I think i understand this more now. I only stumbled upon this function for bezier curves yesterday, and it's not something i'm familiar with. Using your examples i managed to implement something roughly that works... although my implementation seems to...
by unixfreak
Wed Apr 19, 2017 8:50 am
Forum: Support and Development
Topic: [SOLVED] Bezier Curves, how to trace a line?
Replies: 21
Views: 5048

Re: Bezier Curves, how to trace a line?

May be something like you want. (old love with extraneous code) Click on control points to see effect, Thanks, i'll have a look at the code later, that should be useful. And now another episode of Two and a Half coordinates: Or i just clobbered together a snippet in about 30 seconds and ran it once...
by unixfreak
Wed Apr 19, 2017 2:08 am
Forum: Support and Development
Topic: [SOLVED] Bezier Curves, how to trace a line?
Replies: 21
Views: 5048

[SOLVED] Bezier Curves, how to trace a line?

How can i make a point traverse across a bezier curve? I whipped up a small example which hopefully will show what i want to achieve. I'm trying to get an object to travel along a defined bezier curve, but having trouble figuring out how i would do this. Basically, i want to plot 2 points, then move...
by unixfreak
Wed Apr 19, 2017 12:55 am
Forum: Games and Creations
Topic: Space Worm
Replies: 4
Views: 1317

Re: Space Worm

Fantastic. Really like the overall style of the game. Very nice job!