Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

math - Calculus? Need help solving for a time-dependent variable given some other variables -


long story short, i'm making platform game. i'm not old enough have taken calculus yet, know not of derivatives or integrals, know of them. desired behavior character automagically jump when there block either side of him above 1 he's standing on; instance, stairs. way player can hold left / right climb stairs, instead of having spam jump key too.

the issue way i've implemented jumping; i've decided go mario-style, , allow player hold 'jump' longer jump higher. so, have 'jump' variable added player's y velocity. jump variable increases set value when 'jump' key pressed, , decreases once 'jump' key released, decreases less long hold 'jump' key down, providing continuous acceleration long hold 'jump.' makes nice, flowing jump, rather visually jarring, abrupt acceleration.

so, in order account variable stair height, want able calculate value 'jump' variable should in order jump height of stair; preferably no more, no less, though more permissible. way character can jump steep or shallow flights of stairs without looking weird or being slow.

there 5 variables in play:

h -the height character needs jump reach stair top<br> j -the jump acceleration variable<br> v -the vertical velocity of character<br> p -the vertical position of character<br> d -initial vertical position of player minus final position<br>  each timestep:<br> j -= 1.5;          //the jump variable's deceleration<br> v -= j;            //the jump value's influence on vertical speed<br> v *= 0.95;         //friction on vertical speed<br> v += 1;            //gravity<br> p += v;            //add vertical speed vertical position<br>  v-initial known zero<br> v-final known zero<br> p-initial known<br> p-final known<br> d known p-initial minus p-final<br> j-final known zero<br>  j-initial unknown<br> 

given of these facts, how can make equation solve j?

tl;dr how calculus?

much who's made far , decides plow through problem.

edit: here's graph made of example in excel. alt text

i want equation let me find value given desired value b. since jump variable decreases on time, position value isn't simple parabola.

there 2 difficulties in play here. first don't have j -= 1.5, have j = max(0, j - 1.5). throws of wrench calculations. also, friction term v *= 0.95 makes direct solution difficult.

i suggest using lookup table this. can precalculate desired a each possible b, trial , error (e.g. binary search on values of a give required b). store results in table , simple table lookup during game.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -