96D07E7E-68E6-44EE-97C8-A05F2883C472
FE4D5C14-1CC9-4721-83EF-DBCA2FE452FC
FA85A580-8395-46D7-A5E1-8A1F8282888C
E6B61468-6148-45ED-8496-DBD61F6A5ABB
BF4E00AD-BA79-4EC7-9FA9-38AFE2AEFE55
// Gravity pulls the player down, | |
// but the slope of the hill pushes them in another direction. | |
static const float G = ...; // Acceleration due to gravity. | |
// First find what percentage of gravity is wasted opposing the ground normal: | |
float dotN = Vector3.Dot(groundNormal, -Vector3.up); | |
// Or simplified, just -groundNormal.y | |
// Subtract that from the down vector to get the percent |
So I haven't worked on Chipmunk heavily for several years. Why? I used to make games for myself in the past, but other than game jams I haven't in a few years. We also used to make part of our living working on Chipmunk, but now have to focus on a lot of other projects. I've gotten to work on some really neat projects lately, like a PS4/Xbox game and drone mapping software. Nothing that has needed 2D physics simulation though. | |
At the same time, Chipmunk will be 11 years old in September of 2017. On the one hand, I feel like it has become very mature. It does what it's supposed to do very well at this point. On the other hand there are changes that I'd like to make, but it's very hard to make them at this point. For example: | |
* Supporting C code on MSVC is a giant pain. They've made it clear that they will never, ever support anything newer than C89. I could save myself a lot of trouble by switching the implementation to C++11, and leaving the API as plain old C. | |
* Speculative contacts would be a very intere |
using UnityEngine; | |
using System.Collections; | |
// This script is meant to be attached to your main camera. | |
// If you want to use it on more than one camera at a time, it will require | |
// modifcations due to the Camera.on* delegates in OnEnable()/OnDisable(). | |
[ExecuteInEditMode] | |
public class CustomProjection : MonoBehaviour { | |
private void OnEnable(){ |
using UnityEngine; | |
using System.Collections; | |
[ExecuteInEditMode] | |
public class TreesCamera : MonoBehaviour { | |
private void OnEnable(){ | |
// Optional, only enable the callbacks when in the editor. | |
if(Application.isEditor){ | |
// These callbacks are invoked for all cameras including the scene view and camera previews. | |
Camera.onPreCull += ScenePreCull; |
using UnityEngine; | |
using System.Collections; | |
[ExecuteInEditMode] | |
public class TreesCamera : MonoBehaviour { | |
private void OnEnable(){ | |
Camera.onPreRender += PreRender; | |
Camera.onPostRender += PostRender; | |
} |
96D07E7E-68E6-44EE-97C8-A05F2883C472
FE4D5C14-1CC9-4721-83EF-DBCA2FE452FC
FA85A580-8395-46D7-A5E1-8A1F8282888C
E6B61468-6148-45ED-8496-DBD61F6A5ABB
BF4E00AD-BA79-4EC7-9FA9-38AFE2AEFE55
uniform sampler2D texture; | |
varying vec2 uv; | |
void main(){ | |
vec2 size = textureSize(texture); | |
vec2 puv = uv*size; | |
vec2 hfw = 0.5*fwidth(puv); | |
vec2 fl = floor(puv - 0.5) + 0.5; |
// in the .h file | |
@interface Foo : Bar { | |
@public | |
int _ivar1; | |
@protected | |
int _ivar2; | |
int _property2; | |
@private | |
int _ivar3; |
require 'matrix' | |
Constraints = Matrix[ | |
[ 1.0, -1.0, 0.0, 1.0, -1.0], | |
[ 1.0, 1.0, -1.0, 0.0, 0.0], | |
[ 1.0, -1.0, 0.0, -1.0, 1.0], | |
] | |
puts "Constraints: #{Constraints}" |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <setjmp.h> | |
#include "jpeglib.h" | |
extern long image_memory(int numbytes, void *data_ptr); | |
extern void throw_error(char *filename, char *error); | |
struct my_error_mgr { |