Topic:   SC Physics   (Read 64156 times)


0 Members and 1 Guest are viewing this topic.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: SC Physics
« Reply #60 on: February 06, 2011, 10:07:06 PM »
I made some code for a ship which I calibrated to work by tapping keys to work around SC's key down issue, and it worked fine on a box with these same traits. But when I made it a triangle it drew it and it wouldn't move. What would cause the physics to freeze?
Code: [Select]
LET player = CreatePolygon( "0,0;15,40;30,0", 100, 100, 0.2, 0.1, 0.6, "Dynamic", 0)
SetFixedRotation player, TRUE
EDIT: While I'm asking questions how do I make it respond to a collision? There is no "if shape a touches shape(s) b".
EDIT 2: OMG GAN'S MAKING DEFENSE GAEM
« Last Edit: February 06, 2011, 10:15:47 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: SC Physics
« Reply #61 on: February 06, 2011, 11:36:09 PM »
Your triangle has it's vertices going clock wise. Polygons must be counter clock wise and convex. Flipping the 3 vertices backwards should fix it. I'm working on fixing this so concave and clock wise vertices work.

For collision detection just use rectangle distance code to see if a shape is this close to another shape. I'm working on a collision detection method that'll hopefully return a collision with the exact point of intersection.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: SC Physics
« Reply #62 on: February 07, 2011, 04:48:24 PM »
Sweet, looking forward to that. When that happens I can do tons of things with it. Ship Lander practically makes itself. XD
By the way you should test sprites with polygons, it works but it's offset to the lower left corner.

EDIT: OK more weird crap, it seems as though Key Down behaves erratically when I have a sprite set to follow the ship. When I did it was lagging, when I turned off the sprite it worked fine. The whole program doesn't lag, just the controls. ???
« Last Edit: February 07, 2011, 04:58:07 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: SC Physics
« Reply #63 on: February 07, 2011, 05:35:15 PM »
Hmm. I think I encountered that problem before. I'll look into it. If you port or pm your project I probably could find and fix it faster.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: SC Physics
« Reply #64 on: February 07, 2011, 08:01:28 PM »
OK I will, I have to get off the computer now, I was just uploading this test, about the transfer of energy. The one on the left works like in real life and the desk toy failed horribly. XD
But it's funny to watch, anyway.
https://sites.google.com/site/onronc/Experiments.scproj?attredirects=0&d=1

EDIT:
Updated it. The pendulum works now, I just make them way denser.
And I found out that while objects with sprites on them are moving in my case it lags like you wouldn't believe and impedes user input. I had to let the balls settle before it stopped and I could quit out. So it WAS the whole program, Matt. Thing is I didn't have that problem with your example. ???
EDIT 2:
workaround, for those who had trouble:
Code: [Select]
ON TIMER 2
 Â  MOVESPRITE 1, shapex(1)-25, shapey(1)-25, TRUE
 Â  MOVESPRITE 2, shapex(2)-10, shapey(2)-10, TRUE
 Â  MOVESPRITE 3, shapex(3)-25, shapey(3)-25, TRUE
 Â  UPDATESCREEN
END TIMER
« Last Edit: February 07, 2011, 10:21:59 PM by Connors »
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: SC Physics
« Reply #65 on: February 07, 2011, 10:38:53 PM »
Awesome, I'll go through this tomorrow. Fix this bug, try the engine with Sc B3...

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: SC Physics
« Reply #66 on: February 08, 2011, 03:21:49 PM »
FYI I tried my project and your examples with the new version of SC and it crashed both times.  :(
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Zoo


  • GMG Extraordinaire

  • ***


  • Posts: 1686
    • My Bandcamp
Re: SC Physics
« Reply #67 on: February 08, 2011, 04:31:45 PM »
how do you open a binary file, anyway?
Kirby, your pudgy buddy from dream land, is back again on the game boy®!

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: SC Physics
« Reply #68 on: February 08, 2011, 05:26:04 PM »
If it's an app, double click to open. If it's a plain file you might need another application to open it.

I tried out the pendulum. That's an awesome idea, surprised I didn't think of it...  
Yeah, a restitution of 1.0 and density of 1.0 fixes it.

As for sprites, I believe it lags cause in my code I didn't set it to TRUE to hold off on updating. I'll fix it.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: SC Physics
« Reply #69 on: February 08, 2011, 10:06:02 PM »
SC Physics appears to work perfectly in Sc B3.1.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: SC Physics
« Reply #70 on: February 08, 2011, 10:33:20 PM »
Yeah, no problems with the new version here! 8)
Oh and I uploaded a new version of my "Experiments", same link in the original post.
I wanted to try making a piston motor. (The wheel moves the block instead of vice versa). I then remembered a glitch that i forgot to report before, where distance joints glitch out if you offset where they are connected. It seems to relate directly to the height, but it makes for some interesting machines. XD Even weirder is I don't think it happened to the car.
 Could this be a result of your switching the coordinates system Matt?
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: SC Physics
« Reply #71 on: February 08, 2011, 10:43:05 PM »
That's some way cool stuff.

But yeah you're right. I believe that's due to me flipping the coordinate system.

I'll take a deeper look tomorrow, fix some bugs, add some new features, maybe toss in an extra joint or two...
Cause I have a snow day tomorrow. YEAH!

You mind if I put some of your experiments into the Sc Physics demos?
« Last Edit: February 08, 2011, 10:44:46 PM by Gandolf »

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: SC Physics
« Reply #72 on: February 09, 2011, 07:30:15 AM »
Sure, go ahead. ;D
Snow days are cool!
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: SC Physics
« Reply #73 on: February 09, 2011, 12:01:19 PM »
seriously, someone has to make a dirtbike game with this. anyone remember those games? you would move the mouse to the top of the screen to accelerate
« Last Edit: February 09, 2011, 12:02:13 PM by EqwanoX »

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: SC Physics
« Reply #74 on: February 09, 2011, 12:31:29 PM »
Oh yeah! I had one that you control with only the mouse. It was hard. It would also work fine in SC. The thing is I'd need to figure out how to make terrain... But I have one idea to try.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/